From 10c68ad0b9e80df25649ebb0a766230db2b4fc76 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 12 Mar 2024 07:31:10 +0000 Subject: [PATCH] CodeGen from PR 28215 in Azure/azure-rest-api-specs Merge 3004d02873a4b583ba6a3966a370f1ba19b5da1d into c45a7f47c1901149828eb8a33c74898c554659c0 --- ...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 | 490 +++++----- .../MockableNotificationHubsArmClient.cs | 72 +- ...leNotificationHubsResourceGroupResource.cs | 12 +- ...bleNotificationHubsSubscriptionResource.cs | 32 +- .../Extensions/NotificationHubsExtensions.cs | 130 ++- ...NotificationHubNamespaceOperationSource.cs | 40 + ...dpointConnectionResourceOperationSource.cs | 40 + .../AdmCredentialProperties.Serialization.cs | 135 +++ .../Models/AdmCredentialProperties.cs | 90 ++ .../ApnsCredentialProperties.Serialization.cs | 206 +++++ .../Models/ApnsCredentialProperties.cs | 122 +++ ...horizationRuleAccessRight.Serialization.cs | 30 - .../Models/AuthorizationRuleAccessRight.cs | 44 +- ...BaiduCredentialProperties.Serialization.cs | 135 +++ .../Models/BaiduCredentialProperties.cs | 90 ++ .../Models/BrowserCredential.Serialization.cs | 119 +++ ...rUpdateContent.cs => BrowserCredential.cs} | 24 +- ...owserCredentialProperties.Serialization.cs | 135 +++ .../Models/BrowserCredentialProperties.cs | 90 ++ .../Models/DebugSendResult.Serialization.cs | 167 ++++ .../src/Generated/Models/DebugSendResult.cs | 75 ++ ...on.cs => FcmV1Credential.Serialization.cs} | 42 +- .../src/Generated/Models/FcmV1Credential.cs | 76 ++ ...FcmV1CredentialProperties.Serialization.cs | 135 +++ .../Models/FcmV1CredentialProperties.cs | 90 ++ .../GcmCredentialProperties.Serialization.cs | 131 +++ .../Models/GcmCredentialProperties.cs | 80 ++ .../Generated/Models/IPRule.Serialization.cs | 137 +++ .../src/Generated/Models/IPRule.cs | 84 ++ .../MpnsCredentialProperties.Serialization.cs | 135 +++ .../Models/MpnsCredentialProperties.cs | 90 ++ .../NamespaceProperties.Serialization.cs | 415 +++++++++ .../Generated/Models/NamespaceProperties.cs | 161 ++++ .../src/Generated/Models/NamespaceStatus.cs | 57 ++ .../Models/NetworkAcls.Serialization.cs | 152 ++++ .../src/Generated/Models/NetworkAcls.cs | 77 ++ ...ificationHubAdmCredential.Serialization.cs | 55 +- .../Models/NotificationHubAdmCredential.cs | 33 +- ...ficationHubApnsCredential.Serialization.cs | 117 +-- .../Models/NotificationHubApnsCredential.cs | 51 +- ...ionHubAvailabilityContent.Serialization.cs | 22 +- .../NotificationHubAvailabilityContent.cs | 19 +- .../NotificationHubAvailabilityResult.cs | 14 +- ...icationHubBaiduCredential.Serialization.cs | 55 +- .../Models/NotificationHubBaiduCredential.cs | 33 +- ...nHubCreateOrUpdateContent.Serialization.cs | 383 -------- .../NotificationHubCreateOrUpdateContent.cs | 117 --- ...ificationHubGcmCredential.Serialization.cs | 44 +- .../Models/NotificationHubGcmCredential.cs | 29 +- ...NotificationHubListResult.Serialization.cs | 4 +- .../Models/NotificationHubListResult.cs | 8 +- ...ficationHubMpnsCredential.Serialization.cs | 49 +- .../Models/NotificationHubMpnsCredential.cs | 31 +- ...paceCreateOrUpdateContent.Serialization.cs | 425 --------- ...cationHubNamespaceCreateOrUpdateContent.cs | 135 --- ...ionHubNamespaceListResult.Serialization.cs | 4 +- .../NotificationHubNamespaceListResult.cs | 8 +- ...ficationHubNamespacePatch.Serialization.cs | 43 +- .../Models/NotificationHubNamespacePatch.cs | 20 +- ...ificationHubNamespaceType.Serialization.cs | 28 - .../Models/NotificationHubNamespaceType.cs | 41 +- .../NotificationHubPatch.Serialization.cs | 245 +---- .../Generated/Models/NotificationHubPatch.cs | 72 +- ...ficationHubPnsCredentials.Serialization.cs | 125 +-- .../Models/NotificationHubPnsCredentials.cs | 39 +- ...NotificationHubProperties.Serialization.cs | 323 +++++++ .../Models/NotificationHubProperties.cs | 178 ++++ ...tificationHubResourceKeys.Serialization.cs | 10 +- .../Models/NotificationHubResourceKeys.cs | 28 +- .../Generated/Models/NotificationHubSku.cs | 22 +- .../Models/NotificationHubSkuName.cs | 2 +- ...ficationHubTestSendResult.Serialization.cs | 84 +- .../Models/NotificationHubTestSendResult.cs | 51 +- ...ificationHubWnsCredential.Serialization.cs | 55 +- .../Models/NotificationHubWnsCredential.cs | 33 +- ...vateEndpointConnectionProvisioningState.cs | 69 ++ ...ateLinkResourceListResult.Serialization.cs | 148 +++ ...cationHubsPrivateLinkResourceListResult.cs | 71 ++ ...ateLinkResourceProperties.Serialization.cs | 173 ++++ ...cationHubsPrivateLinkResourceProperties.cs | 76 ++ .../Models/OperationProvisioningState.cs | 66 ++ .../Models/PnsCredentials.Serialization.cs | 257 ++++++ .../src/Generated/Models/PnsCredentials.cs | 159 ++++ ....cs => PolicyKeyResource.Serialization.cs} | 50 +- ...onHubPolicyKey.cs => PolicyKeyResource.cs} | 25 +- .../src/Generated/Models/PolicyKeyType.cs | 51 ++ ...pointConnectionProperties.Serialization.cs | 183 ++++ .../PrivateEndpointConnectionProperties.cs | 87 ++ ...nectionResourceListResult.Serialization.cs | 148 +++ ...ateEndpointConnectionResourceListResult.cs | 71 ++ .../Models/PrivateLinkConnectionStatus.cs | 57 ++ ...InternetAuthorizationRule.Serialization.cs | 129 +++ .../Models/PublicInternetAuthorizationRule.cs | 77 ++ .../Generated/Models/PublicNetworkAccess.cs | 51 ++ .../RegistrationResult.Serialization.cs | 156 ++++ .../Generated/Models/RegistrationResult.cs | 77 ++ ...inkServiceConnectionState.Serialization.cs | 149 +++ ...RemotePrivateLinkServiceConnectionState.cs | 73 ++ .../src/Generated/Models/ReplicationRegion.cs | 69 ++ ...thorizationRuleListResult.Serialization.cs | 4 +- ...SharedAccessAuthorizationRuleListResult.cs | 8 +- ...thorizationRuleProperties.Serialization.cs | 73 +- ...SharedAccessAuthorizationRuleProperties.cs | 76 +- .../WnsCredentialProperties.Serialization.cs | 173 ++++ .../Models/WnsCredentialProperties.cs | 81 ++ .../Models/XiaomiCredential.Serialization.cs | 119 +++ .../src/Generated/Models/XiaomiCredential.cs | 76 ++ ...iaomiCredentialProperties.Serialization.cs | 134 +++ .../Models/XiaomiCredentialProperties.cs | 69 ++ .../Models/ZoneRedundancyPreference.cs | 51 ++ ...> NamespaceAuthorizationRuleCollection.cs} | 195 ++-- .../NamespaceAuthorizationRuleResource.cs | 847 +++++++++++++++++ ...ficationHubAuthorizationRuleCollection.cs} | 195 ++-- ...otificationHubAuthorizationRuleResource.cs | 848 ++++++++++++++++++ ...nHubAuthorizationRuleData.Serialization.cs | 163 +--- .../NotificationHubAuthorizationRuleData.cs | 49 +- ...otificationHubAuthorizationRuleResource.cs | 511 ----------- .../Generated/NotificationHubCollection.cs | 77 +- .../NotificationHubData.Serialization.cs | 181 +--- .../src/Generated/NotificationHubData.cs | 49 +- ...onHubNamespaceAuthorizationRuleResource.cs | 510 ----------- .../NotificationHubNamespaceCollection.cs | 89 +- ...ificationHubNamespaceData.Serialization.cs | 224 +---- .../Generated/NotificationHubNamespaceData.cs | 75 +- .../NotificationHubNamespaceResource.cs | 354 ++++++-- .../src/Generated/NotificationHubResource.cs | 110 ++- .../NotificationHubsPrivateLinkResource.cs | 175 ++++ ...cationHubsPrivateLinkResourceCollection.cs | 399 ++++++++ ...bsPrivateLinkResourceData.Serialization.cs | 182 ++++ ...NotificationHubsPrivateLinkResourceData.cs | 75 ++ .../PrivateEndpointConnectionResource.cs | 355 ++++++++ ...ateEndpointConnectionResourceCollection.cs | 499 +++++++++++ ...intConnectionResourceData.Serialization.cs | 182 ++++ .../PrivateEndpointConnectionResourceData.cs | 75 ++ .../NamespacesRestOperations.cs | 741 ++++++++------- .../NotificationHubsRestOperations.cs | 626 ++++++------- ...rivateEndpointConnectionsRestOperations.cs | 570 ++++++++++++ .../src/autorest.md | 2 +- 150 files changed, 14399 insertions(+), 5791 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 rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/{SharedAccessAuthorizationRuleCreateOrUpdateContent.cs => BrowserCredential.cs} (62%) 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 rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/{SharedAccessAuthorizationRuleCreateOrUpdateContent.Serialization.cs => FcmV1Credential.Serialization.cs} (52%) 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 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/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/{NotificationHubPolicyKey.Serialization.cs => PolicyKeyResource.Serialization.cs} (56%) rename sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/{NotificationHubPolicyKey.cs => PolicyKeyResource.cs} (66%) 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/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 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} (55%) 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.Serialization.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.Serialization.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 0c9dade5eaeb..c9eb22dd2eed 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/ArmNotificationHubsModelFactory.cs @@ -24,10 +24,10 @@ public static partial class ArmNotificationHubsModelFactory /// The systemData. /// The tags. /// The location. - /// The sku of the created namespace. - /// 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. + /// The Sku description for a namespace. /// A new instance for mocking. - public static NotificationHubAvailabilityContent NotificationHubAvailabilityContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NotificationHubSku sku = null, bool? isAvailiable = null) + public static NotificationHubAvailabilityContent NotificationHubAvailabilityContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, bool? isAvailiable = null, NotificationHubSku sku = null) { tags ??= new Dictionary(); @@ -38,8 +38,8 @@ public static NotificationHubAvailabilityContent NotificationHubAvailabilityCont systemData, tags, location, - sku, isAvailiable, + sku, serializedAdditionalRawData: null); } @@ -50,8 +50,11 @@ public static NotificationHubAvailabilityContent NotificationHubAvailabilityCont /// 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) { @@ -69,136 +72,147 @@ public static NotificationHubAvailabilityResult NotificationHubAvailabilityResul serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// 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( + return new NotificationHubData( id, name, resourceType, systemData, tags, location, - namespaceName, - provisioningState, - region, - metricId, - status, - createdOn, - updatedOn, - serviceBusEndpoint, - subscriptionId, - scaleUnit, - isEnabled, - isCritical, - dataCenter, - namespaceType, + properties, sku, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// 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, serializedAdditionalRawData: null) : null, + wnsCredentialProperties != null ? new NotificationHubWnsCredential(wnsCredentialProperties, serializedAdditionalRawData: null) : null, + gcmCredentialProperties != null ? new NotificationHubGcmCredential(gcmCredentialProperties, serializedAdditionalRawData: null) : null, + mpnsCredentialProperties != null ? new NotificationHubMpnsCredential(mpnsCredentialProperties, serializedAdditionalRawData: null) : null, + admCredentialProperties != null ? new NotificationHubAdmCredential(admCredentialProperties, serializedAdditionalRawData: null) : null, + baiduCredentialProperties != null ? new NotificationHubBaiduCredential(baiduCredentialProperties, serializedAdditionalRawData: null) : null, + browserCredentialProperties != null ? new BrowserCredential(browserCredentialProperties, serializedAdditionalRawData: null) : null, + xiaomiCredentialProperties != null ? new XiaomiCredential(xiaomiCredentialProperties, serializedAdditionalRawData: null) : null, + fcmV1CredentialProperties != null ? new FcmV1Credential(fcmV1CredentialProperties, serializedAdditionalRawData: null) : null, + dailyMaxActiveDevices, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Gets or sets the rights associated with the rule. + /// + /// Gets a base64-encoded 256-bit primary key for signing and + /// validating the SAS token. + /// + /// + /// Gets a base64-encoded 256-bit primary key for signing and + /// validating the SAS token. + /// + /// Gets a string that describes the authorization rule. + /// Gets the last modified time for this rule. + /// Gets the created time for this rule. + /// Gets a string that describes the claim type. + /// Gets a string that describes the claim value. + /// Gets the revision number for the rule. + /// A new instance for mocking. + public static SharedAccessAuthorizationRuleProperties SharedAccessAuthorizationRuleProperties(IEnumerable 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, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// 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( + return new NotificationHubTestSendResult( id, name, resourceType, systemData, tags, location, - namespaceName, - provisioningState, - region, - metricId, - status, - createdOn, - updatedOn, - serviceBusEndpoint, - subscriptionId, - scaleUnit, - isEnabled, - isCritical, - dataCenter, - namespaceType, - sku, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// 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 . + /// 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, - serializedAdditionalRawData: null); + return new DebugSendResult(success, failure, results?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// 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, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -208,21 +222,11 @@ 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, @@ -231,25 +235,19 @@ public static NotificationHubAuthorizationRuleData NotificationHubAuthorizationR systemData, tags, location, - rights?.ToList(), - primaryKey, - secondaryKey, - keyName, - claimType, - claimValue, - modifiedOn, - createdOn, - revision, - sku, + properties, serializedAdditionalRawData: null); } /// Initializes a new instance of . - /// 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) { @@ -262,199 +260,185 @@ public static NotificationHubResourceKeys NotificationHubResourceKeys(string pri serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// 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( + return new NotificationHubPnsCredentials( id, name, resourceType, systemData, tags, location, - notificationHubName, - registrationTtl, - authorizationRules?.ToList(), - apnsCredential, - wnsCredential, - gcmCredential, - mpnsCredential, - admCredential, - baiduCredential, - sku, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// 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( + return new NotificationHubNamespaceData( id, name, resourceType, systemData, tags, location, - notificationHubName, - registrationTtl, - authorizationRules?.ToList(), - apnsCredential, - wnsCredential, - gcmCredential, - mpnsCredential, - admCredential, - baiduCredential, sku, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// 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 . + /// + /// 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, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// 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 NotificationHubTestSendResult( + return new PrivateEndpointConnectionResourceData( id, name, resourceType, systemData, - tags, - location, - success, - failure, - results, - sku, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// 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 PrivateEndpointConnectionProperties(provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, groupIds?.ToList(), connectionState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// 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, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// 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 NotificationHubPnsCredentials( + return new NotificationHubsPrivateLinkResourceData( id, name, resourceType, systemData, - tags, - location, - apnsCredential, - wnsCredential, - gcmCredential, - mpnsCredential, - admCredential, - baiduCredential, - sku, + properties, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// 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 NotificationHubsPrivateLinkResourceProperties(groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), serializedAdditionalRawData: null); + } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs index 5cd886046891..3af93e18ca66 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs @@ -37,51 +37,75 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual NotificationHubNamespaceResource GetNotificationHubNamespaceResource(ResourceIdentifier id) + /// Returns a object. + public virtual NotificationHubResource GetNotificationHubResource(ResourceIdentifier id) { - NotificationHubNamespaceResource.ValidateResourceId(id); - return new NotificationHubNamespaceResource(Client, id); + NotificationHubResource.ValidateResourceId(id); + return new NotificationHubResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual NotificationHubNamespaceAuthorizationRuleResource GetNotificationHubNamespaceAuthorizationRuleResource(ResourceIdentifier id) + /// Returns a object. + public virtual NamespaceNotificationHubAuthorizationRuleResource GetNamespaceNotificationHubAuthorizationRuleResource(ResourceIdentifier id) { - NotificationHubNamespaceAuthorizationRuleResource.ValidateResourceId(id); - return new NotificationHubNamespaceAuthorizationRuleResource(Client, id); + NamespaceNotificationHubAuthorizationRuleResource.ValidateResourceId(id); + return new NamespaceNotificationHubAuthorizationRuleResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(ResourceIdentifier id) + /// Returns a object. + public virtual NamespaceAuthorizationRuleResource GetNamespaceAuthorizationRuleResource(ResourceIdentifier id) { - NotificationHubAuthorizationRuleResource.ValidateResourceId(id); - return new NotificationHubAuthorizationRuleResource(Client, id); + NamespaceAuthorizationRuleResource.ValidateResourceId(id); + return new NamespaceAuthorizationRuleResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual NotificationHubResource GetNotificationHubResource(ResourceIdentifier id) + /// Returns a object. + public virtual NotificationHubNamespaceResource GetNotificationHubNamespaceResource(ResourceIdentifier id) { - NotificationHubResource.ValidateResourceId(id); - return new NotificationHubResource(Client, id); + NotificationHubNamespaceResource.ValidateResourceId(id); + return new NotificationHubNamespaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateEndpointConnectionResource GetPrivateEndpointConnectionResource(ResourceIdentifier id) + { + PrivateEndpointConnectionResource.ValidateResourceId(id); + return new PrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NotificationHubsPrivateLinkResource GetNotificationHubsPrivateLinkResource(ResourceIdentifier id) + { + NotificationHubsPrivateLinkResource.ValidateResourceId(id); + return new NotificationHubsPrivateLinkResource(Client, id); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsResourceGroupResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsResourceGroupResource.cs index 1e7c65ca8bc4..a29f80e7135f 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsResourceGroupResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsResourceGroupResource.cs @@ -44,7 +44,7 @@ public virtual NotificationHubNamespaceCollection GetNotificationHubNamespaces() } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -56,7 +56,7 @@ public virtual NotificationHubNamespaceCollection GetNotificationHubNamespaces() /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -64,7 +64,7 @@ public virtual NotificationHubNamespaceCollection GetNotificationHubNamespaces() /// /// /// - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -75,7 +75,7 @@ public virtual async Task> GetNotific } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -87,7 +87,7 @@ public virtual async Task> GetNotific /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -95,7 +95,7 @@ public virtual async Task> GetNotific /// /// /// - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs index 450a4bd43bfb..0657433fe557 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs @@ -58,7 +58,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -66,7 +66,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// - /// The namespace name. + /// Request content. /// The cancellation token to use. /// is null. public virtual async Task> CheckNotificationHubNamespaceAvailabilityAsync(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -100,7 +100,7 @@ public virtual async Task> CheckNoti /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -108,7 +108,7 @@ public virtual async Task> CheckNoti /// /// /// - /// The namespace name. + /// Request content. /// The cancellation token to use. /// is null. public virtual Response CheckNotificationHubNamespaceAvailability(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -130,7 +130,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 @@ -142,7 +142,7 @@ public virtual Response CheckNotificationHubN /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -150,17 +150,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, "MockableNotificationHubsSubscriptionResource.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 @@ -172,7 +174,7 @@ public virtual AsyncPageable GetNotificationHu /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -180,12 +182,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, "MockableNotificationHubsSubscriptionResource.GetNotificationHubNamespaces", "value", "nextLink", cancellationToken); } } 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 b573847840f4..73347a3781fc 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs @@ -36,79 +36,117 @@ private static MockableNotificationHubsSubscriptionResource GetMockableNotificat } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NotificationHubNamespaceResource GetNotificationHubNamespaceResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NotificationHubResource GetNotificationHubResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNotificationHubsArmClient(client).GetNotificationHubNamespaceResource(id); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NotificationHubNamespaceAuthorizationRuleResource GetNotificationHubNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NamespaceNotificationHubAuthorizationRuleResource GetNamespaceNotificationHubAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNotificationHubsArmClient(client).GetNotificationHubNamespaceAuthorizationRuleResource(id); + return GetMockableNotificationHubsArmClient(client).GetNamespaceNotificationHubAuthorizationRuleResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NamespaceAuthorizationRuleResource GetNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNotificationHubsArmClient(client).GetNotificationHubAuthorizationRuleResource(id); + return GetMockableNotificationHubsArmClient(client).GetNamespaceAuthorizationRuleResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NotificationHubResource GetNotificationHubResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NotificationHubNamespaceResource GetNotificationHubNamespaceResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNotificationHubsArmClient(client).GetNotificationHubResource(id); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubNamespaceResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static PrivateEndpointConnectionResource GetPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNotificationHubsArmClient(client).GetPrivateEndpointConnectionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static NotificationHubsPrivateLinkResource GetNotificationHubsPrivateLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNotificationHubsArmClient(client).GetNotificationHubsPrivateLinkResource(id); } /// @@ -129,7 +167,7 @@ public static NotificationHubNamespaceCollection GetNotificationHubNamespaces(th } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -141,7 +179,7 @@ public static NotificationHubNamespaceCollection GetNotificationHubNamespaces(th /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -154,7 +192,7 @@ public static NotificationHubNamespaceCollection GetNotificationHubNamespaces(th /// /// /// The instance the method will execute against. - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -167,7 +205,7 @@ public static async Task> GetNotifica } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -179,7 +217,7 @@ public static async Task> GetNotifica /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -192,7 +230,7 @@ public static async Task> GetNotifica /// /// /// The instance the method will execute against. - /// The namespace name. + /// Namespace name. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -217,7 +255,7 @@ public static Response GetNotificationHubNames /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -230,7 +268,7 @@ public static Response GetNotificationHubNames /// /// /// The instance the method will execute against. - /// The namespace name. + /// Request content. /// The cancellation token to use. /// or is null. public static async Task> CheckNotificationHubNamespaceAvailabilityAsync(this SubscriptionResource subscriptionResource, NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -253,7 +291,7 @@ public static async Task> CheckNotif /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -266,7 +304,7 @@ public static async Task> CheckNotif /// /// /// The instance the method will execute against. - /// The namespace name. + /// Request content. /// The cancellation token to use. /// or is null. public static Response CheckNotificationHubNamespaceAvailability(this SubscriptionResource subscriptionResource, NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -277,7 +315,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 @@ -289,7 +327,7 @@ public static Response CheckNotificationHubNa /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -298,22 +336,24 @@ public static Response CheckNotificationHubNa /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. /// is null. /// 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) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNotificationHubsSubscriptionResource(subscriptionResource).GetNotificationHubNamespacesAsync(cancellationToken); + return GetMockableNotificationHubsSubscriptionResource(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 @@ -325,7 +365,7 @@ public static AsyncPageable GetNotificationHub /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -334,18 +374,20 @@ public static AsyncPageable GetNotificationHub /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// Skip token for subsequent requests. + /// Maximum number of results to return. /// The cancellation token to use. /// is null. /// 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) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNotificationHubsSubscriptionResource(subscriptionResource).GetNotificationHubNamespaces(cancellationToken); + return GetMockableNotificationHubsSubscriptionResource(subscriptionResource).GetNotificationHubNamespaces(skipToken, top, 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..e57f64b8c6f8 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class AdmCredentialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdmCredentialProperties)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + writer.WritePropertyName("clientSecret"u8); + writer.WriteStringValue(ClientSecret); + writer.WritePropertyName("authTokenUrl"u8); + writer.WriteStringValue(AuthTokenUri.AbsoluteUri); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AdmCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdmCredentialProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAdmCredentialProperties(document.RootElement, options); + } + + internal static AdmCredentialProperties DeserializeAdmCredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientId = default; + string clientSecret = default; + Uri authTokenUrl = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new AdmCredentialProperties(clientId, clientSecret, authTokenUrl, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AdmCredentialProperties)} does not support '{options.Format}' format."); + } + } + + AdmCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAdmCredentialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AdmCredentialProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..11db7e6ee29e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/AdmCredentialProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub AdmCredential. + public partial class AdmCredentialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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; + } + + /// Initializes a new instance of . + /// Gets or sets the client identifier. + /// Gets or sets the credential secret access key. + /// Gets or sets the URL of the authorization token. + /// Keeps track of any properties unknown to the library. + internal AdmCredentialProperties(string clientId, string clientSecret, Uri authTokenUri, IDictionary serializedAdditionalRawData) + { + ClientId = clientId; + ClientSecret = clientSecret; + AuthTokenUri = authTokenUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AdmCredentialProperties() + { + } + + /// 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..0523362177be --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.Serialization.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class ApnsCredentialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ApnsCredentialProperties)} does not support '{format}' format."); + } + + 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); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ApnsCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ApnsCredentialProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeApnsCredentialProperties(document.RootElement, options); + } + + internal static ApnsCredentialProperties DeserializeApnsCredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string apnsCertificate = default; + string certificateKey = default; + string endpoint = default; + string thumbprint = default; + string keyId = default; + string appName = default; + string appId = default; + string token = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new ApnsCredentialProperties( + apnsCertificate, + certificateKey, + endpoint, + thumbprint, + keyId, + appName, + appId, + token, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ApnsCredentialProperties)} does not support '{options.Format}' format."); + } + } + + ApnsCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeApnsCredentialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ApnsCredentialProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..d6a80787f1cc --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/ApnsCredentialProperties.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub ApnsCredential. + public partial class ApnsCredentialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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 . + /// 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 + /// + /// Keeps track of any properties unknown to the library. + internal ApnsCredentialProperties(string apnsCertificate, string certificateKey, string endpoint, string thumbprint, string keyId, string appName, string appId, string token, IDictionary serializedAdditionalRawData) + { + ApnsCertificate = apnsCertificate; + CertificateKey = certificateKey; + Endpoint = endpoint; + Thumbprint = thumbprint; + KeyId = keyId; + AppName = appName; + AppId = appId; + Token = token; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApnsCredentialProperties() + { + } + + /// 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..e8e01fe3008e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class BaiduCredentialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaiduCredentialProperties)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("baiduApiKey"u8); + writer.WriteStringValue(BaiduApiKey); + writer.WritePropertyName("baiduEndPoint"u8); + writer.WriteStringValue(BaiduEndPoint); + writer.WritePropertyName("baiduSecretKey"u8); + writer.WriteStringValue(BaiduSecretKey); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + BaiduCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaiduCredentialProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBaiduCredentialProperties(document.RootElement, options); + } + + internal static BaiduCredentialProperties DeserializeBaiduCredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string baiduApiKey = default; + string baiduEndPoint = default; + string baiduSecretKey = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new BaiduCredentialProperties(baiduApiKey, baiduEndPoint, baiduSecretKey, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BaiduCredentialProperties)} does not support '{options.Format}' format."); + } + } + + BaiduCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBaiduCredentialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BaiduCredentialProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..5c54b1f377ff --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BaiduCredentialProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub BaiduCredential. + public partial class BaiduCredentialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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; + } + + /// Initializes a new instance of . + /// Gets or sets baidu Api Key. + /// Gets or sets baidu Endpoint. + /// Gets or sets baidu Secret Key. + /// Keeps track of any properties unknown to the library. + internal BaiduCredentialProperties(string baiduApiKey, string baiduEndPoint, string baiduSecretKey, IDictionary serializedAdditionalRawData) + { + BaiduApiKey = baiduApiKey; + BaiduEndPoint = baiduEndPoint; + BaiduSecretKey = baiduSecretKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BaiduCredentialProperties() + { + } + + /// 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..49495acc759c --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.Serialization.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class BrowserCredential : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrowserCredential)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + BrowserCredential IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrowserCredential)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrowserCredential(document.RootElement, options); + } + + internal static BrowserCredential DeserializeBrowserCredential(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BrowserCredentialProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = BrowserCredentialProperties.DeserializeBrowserCredentialProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new BrowserCredential(properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrowserCredential)} does not support '{options.Format}' format."); + } + } + + BrowserCredential IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrowserCredential(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrowserCredential)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.cs similarity index 62% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.cs index e836001ad25c..36a5fc1b262b 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredential.cs @@ -11,8 +11,8 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - /// Parameters supplied to the CreateOrUpdate Namespace AuthorizationRules. - public partial class SharedAccessAuthorizationRuleCreateOrUpdateContent + /// Description of a NotificationHub BrowserCredential. + internal partial class BrowserCredential { /// /// Keeps track of any properties unknown to the library. @@ -46,31 +46,31 @@ public partial class SharedAccessAuthorizationRuleCreateOrUpdateContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Properties of the Namespace AuthorizationRules. + /// Initializes a new instance of . + /// Description of a NotificationHub BrowserCredential. /// is null. - public SharedAccessAuthorizationRuleCreateOrUpdateContent(SharedAccessAuthorizationRuleProperties properties) + public BrowserCredential(BrowserCredentialProperties properties) { Argument.AssertNotNull(properties, nameof(properties)); Properties = properties; } - /// Initializes a new instance of . - /// Properties of the Namespace AuthorizationRules. + /// Initializes a new instance of . + /// Description of a NotificationHub BrowserCredential. /// Keeps track of any properties unknown to the library. - internal SharedAccessAuthorizationRuleCreateOrUpdateContent(SharedAccessAuthorizationRuleProperties properties, IDictionary serializedAdditionalRawData) + internal BrowserCredential(BrowserCredentialProperties properties, IDictionary serializedAdditionalRawData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal SharedAccessAuthorizationRuleCreateOrUpdateContent() + /// Initializes a new instance of for deserialization. + internal BrowserCredential() { } - /// Properties of the Namespace AuthorizationRules. - public SharedAccessAuthorizationRuleProperties Properties { get; } + /// 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..7974218c75fe --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class BrowserCredentialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrowserCredentialProperties)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("subject"u8); + writer.WriteStringValue(Subject); + writer.WritePropertyName("vapidPrivateKey"u8); + writer.WriteStringValue(VapidPrivateKey); + writer.WritePropertyName("vapidPublicKey"u8); + writer.WriteStringValue(VapidPublicKey); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + BrowserCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrowserCredentialProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrowserCredentialProperties(document.RootElement, options); + } + + internal static BrowserCredentialProperties DeserializeBrowserCredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subject = default; + string vapidPrivateKey = default; + string vapidPublicKey = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new BrowserCredentialProperties(subject, vapidPrivateKey, vapidPublicKey, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrowserCredentialProperties)} does not support '{options.Format}' format."); + } + } + + BrowserCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrowserCredentialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrowserCredentialProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..fe668b4a495e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/BrowserCredentialProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub BrowserCredential. + public partial class BrowserCredentialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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; + } + + /// Initializes a new instance of . + /// Gets or sets web push subject. + /// Gets or sets VAPID private key. + /// Gets or sets VAPID public key. + /// Keeps track of any properties unknown to the library. + internal BrowserCredentialProperties(string subject, string vapidPrivateKey, string vapidPublicKey, IDictionary serializedAdditionalRawData) + { + Subject = subject; + VapidPrivateKey = vapidPrivateKey; + VapidPublicKey = vapidPublicKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrowserCredentialProperties() + { + } + + /// 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..d5c60eec83ea --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class DebugSendResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DebugSendResult)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Success)) + { + writer.WritePropertyName("success"u8); + writer.WriteNumberValue(Success.Value); + } + if (options.Format != "W" && Optional.IsDefined(Failure)) + { + writer.WritePropertyName("failure"u8); + writer.WriteNumberValue(Failure.Value); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Results)) + { + writer.WritePropertyName("results"u8); + writer.WriteStartArray(); + foreach (var item in Results) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DebugSendResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DebugSendResult)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDebugSendResult(document.RootElement, options); + } + + internal static DebugSendResult DeserializeDebugSendResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? success = default; + long? failure = default; + IReadOnlyList results = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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, options)); + } + results = array; + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DebugSendResult(success, failure, results ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DebugSendResult)} does not support '{options.Format}' format."); + } + } + + DebugSendResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDebugSendResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DebugSendResult)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..c01ef8818d35 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/DebugSendResult.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Result of DebugSend operations. + public partial class DebugSendResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DebugSendResult() + { + Results = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Gets or sets successful send. + /// Gets or sets send failure. + /// Gets or sets actual failure description. + /// Keeps track of any properties unknown to the library. + internal DebugSendResult(long? success, long? failure, IReadOnlyList results, IDictionary serializedAdditionalRawData) + { + Success = success; + Failure = failure; + Results = results; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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/SharedAccessAuthorizationRuleCreateOrUpdateContent.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.Serialization.cs similarity index 52% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.Serialization.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.Serialization.cs index e7cd52ad7dfb..c62e61dc5dd0 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleCreateOrUpdateContent.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.Serialization.cs @@ -13,16 +13,16 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class SharedAccessAuthorizationRuleCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel + internal partial class FcmV1Credential : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(SharedAccessAuthorizationRuleCreateOrUpdateContent)} does not support '{format}' format."); + throw new FormatException($"The model {nameof(FcmV1Credential)} does not support '{format}' format."); } writer.WriteStartObject(); @@ -46,19 +46,19 @@ void IJsonModel.Write(Utf8Js writer.WriteEndObject(); } - SharedAccessAuthorizationRuleCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FcmV1Credential IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(SharedAccessAuthorizationRuleCreateOrUpdateContent)} does not support '{format}' format."); + throw new FormatException($"The model {nameof(FcmV1Credential)} does not support '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSharedAccessAuthorizationRuleCreateOrUpdateContent(document.RootElement, options); + return DeserializeFcmV1Credential(document.RootElement, options); } - internal static SharedAccessAuthorizationRuleCreateOrUpdateContent DeserializeSharedAccessAuthorizationRuleCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static FcmV1Credential DeserializeFcmV1Credential(JsonElement element, ModelReaderWriterOptions options = null) { options ??= new ModelReaderWriterOptions("W"); @@ -66,14 +66,14 @@ internal static SharedAccessAuthorizationRuleCreateOrUpdateContent DeserializeSh { return null; } - SharedAccessAuthorizationRuleProperties properties = default; + FcmV1CredentialProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) { - properties = SharedAccessAuthorizationRuleProperties.DeserializeSharedAccessAuthorizationRuleProperties(property.Value, options); + properties = FcmV1CredentialProperties.DeserializeFcmV1CredentialProperties(property.Value, options); continue; } if (options.Format != "W") @@ -82,38 +82,38 @@ internal static SharedAccessAuthorizationRuleCreateOrUpdateContent DeserializeSh } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new SharedAccessAuthorizationRuleCreateOrUpdateContent(properties, serializedAdditionalRawData); + return new FcmV1Credential(properties, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(SharedAccessAuthorizationRuleCreateOrUpdateContent)} does not support '{options.Format}' format."); + throw new FormatException($"The model {nameof(FcmV1Credential)} does not support '{options.Format}' format."); } } - SharedAccessAuthorizationRuleCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FcmV1Credential IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeSharedAccessAuthorizationRuleCreateOrUpdateContent(document.RootElement, options); + return DeserializeFcmV1Credential(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(SharedAccessAuthorizationRuleCreateOrUpdateContent)} does not support '{options.Format}' format."); + throw new FormatException($"The model {nameof(FcmV1Credential)} does not support '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } 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..a97b6cbf0a52 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1Credential.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub FcmV1Credential. + internal partial class FcmV1Credential + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Description of a NotificationHub FcmV1Credential. + /// is null. + public FcmV1Credential(FcmV1CredentialProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of . + /// Description of a NotificationHub FcmV1Credential. + /// Keeps track of any properties unknown to the library. + internal FcmV1Credential(FcmV1CredentialProperties properties, IDictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FcmV1Credential() + { + } + + /// 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..74456ec3097c --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class FcmV1CredentialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FcmV1CredentialProperties)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("clientEmail"u8); + writer.WriteStringValue(ClientEmail); + writer.WritePropertyName("privateKey"u8); + writer.WriteStringValue(PrivateKey); + writer.WritePropertyName("projectId"u8); + writer.WriteStringValue(ProjectId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FcmV1CredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FcmV1CredentialProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFcmV1CredentialProperties(document.RootElement, options); + } + + internal static FcmV1CredentialProperties DeserializeFcmV1CredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientEmail = default; + string privateKey = default; + string projectId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new FcmV1CredentialProperties(clientEmail, privateKey, projectId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FcmV1CredentialProperties)} does not support '{options.Format}' format."); + } + } + + FcmV1CredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFcmV1CredentialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FcmV1CredentialProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..635b7792401b --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/FcmV1CredentialProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub FcmV1Credential. + public partial class FcmV1CredentialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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; + } + + /// Initializes a new instance of . + /// Gets or sets client email. + /// Gets or sets private key. + /// Gets or sets project id. + /// Keeps track of any properties unknown to the library. + internal FcmV1CredentialProperties(string clientEmail, string privateKey, string projectId, IDictionary serializedAdditionalRawData) + { + ClientEmail = clientEmail; + PrivateKey = privateKey; + ProjectId = projectId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FcmV1CredentialProperties() + { + } + + /// 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..1330fa38f159 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.Serialization.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class GcmCredentialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GcmCredentialProperties)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(GcmEndpoint)) + { + writer.WritePropertyName("gcmEndpoint"u8); + writer.WriteStringValue(GcmEndpoint); + } + writer.WritePropertyName("googleApiKey"u8); + writer.WriteStringValue(GoogleApiKey); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + GcmCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GcmCredentialProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGcmCredentialProperties(document.RootElement, options); + } + + internal static GcmCredentialProperties DeserializeGcmCredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string gcmEndpoint = default; + string googleApiKey = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new GcmCredentialProperties(gcmEndpoint, googleApiKey, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(GcmCredentialProperties)} does not support '{options.Format}' format."); + } + } + + GcmCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGcmCredentialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GcmCredentialProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..c0ebef89927b --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/GcmCredentialProperties.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub GcmCredential. + public partial class GcmCredentialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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 . + /// Gets or sets the GCM endpoint. + /// Gets or sets the Google API key. + /// Keeps track of any properties unknown to the library. + internal GcmCredentialProperties(string gcmEndpoint, string googleApiKey, IDictionary serializedAdditionalRawData) + { + GcmEndpoint = gcmEndpoint; + GoogleApiKey = googleApiKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GcmCredentialProperties() + { + } + + /// 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..bc1e2b133a3b --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class IPRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IPRule)} does not support '{format}' format."); + } + + 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(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + IPRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IPRule)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIPRule(document.RootElement, options); + } + + internal static IPRule DeserializeIPRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string ipMask = default; + IList rights = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new IPRule(ipMask, rights, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(IPRule)} does not support '{options.Format}' format."); + } + } + + IPRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeIPRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IPRule)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..10351078dfce --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/IPRule.cs @@ -0,0 +1,84 @@ +// 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.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// A network authorization rule that filters traffic based on IP address. + public partial class IPRule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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 . + /// IP mask. + /// List of access rights. + /// Keeps track of any properties unknown to the library. + internal IPRule(string ipMask, IList rights, IDictionary serializedAdditionalRawData) + { + IPMask = ipMask; + Rights = rights; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal IPRule() + { + } + + /// 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..b00405ad0233 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class MpnsCredentialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MpnsCredentialProperties)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("mpnsCertificate"u8); + writer.WriteStringValue(MpnsCertificate); + writer.WritePropertyName("certificateKey"u8); + writer.WriteStringValue(CertificateKey); + writer.WritePropertyName("thumbprint"u8); + writer.WriteStringValue(Thumbprint); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + MpnsCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MpnsCredentialProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMpnsCredentialProperties(document.RootElement, options); + } + + internal static MpnsCredentialProperties DeserializeMpnsCredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string mpnsCertificate = default; + string certificateKey = default; + string thumbprint = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new MpnsCredentialProperties(mpnsCertificate, certificateKey, thumbprint, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MpnsCredentialProperties)} does not support '{options.Format}' format."); + } + } + + MpnsCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMpnsCredentialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MpnsCredentialProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..16805edb0e13 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/MpnsCredentialProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub MpnsCredential. + public partial class MpnsCredentialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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; + } + + /// Initializes a new instance of . + /// Gets or sets the MPNS certificate. + /// Gets or sets the certificate key for this credential. + /// Gets or sets the MPNS certificate Thumbprint. + /// Keeps track of any properties unknown to the library. + internal MpnsCredentialProperties(string mpnsCertificate, string certificateKey, string thumbprint, IDictionary serializedAdditionalRawData) + { + MpnsCertificate = mpnsCertificate; + CertificateKey = certificateKey; + Thumbprint = thumbprint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MpnsCredentialProperties() + { + } + + /// 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..116cc7b70d16 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.Serialization.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class NamespaceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamespaceProperties)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(NamespaceName)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(NamespaceName); + } + 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 (options.Format != "W" && Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && Optional.IsDefined(Critical)) + { + writer.WritePropertyName("critical"u8); + writer.WriteBooleanValue(Critical.Value); + } + if (options.Format != "W" && Optional.IsDefined(SubscriptionId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + if (options.Format != "W" && Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (options.Format != "W" && Optional.IsDefined(MetricId)) + { + writer.WritePropertyName("metricId"u8); + writer.WriteStringValue(MetricId); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdAt"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(UpdatedOn)) + { + writer.WritePropertyName("updatedAt"u8); + writer.WriteStringValue(UpdatedOn.Value, "O"); + } + 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 (options.Format != "W" && Optional.IsDefined(ServiceBusEndpoint)) + { + writer.WritePropertyName("serviceBusEndpoint"u8); + writer.WriteStringValue(ServiceBusEndpoint); + } + if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) + { + writer.WritePropertyName("privateEndpointConnections"u8); + writer.WriteStartArray(); + foreach (var item in PrivateEndpointConnections) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + 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()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + NamespaceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamespaceProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNamespaceProperties(document.RootElement, options); + } + + internal static NamespaceProperties DeserializeNamespaceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + OperationProvisioningState? provisioningState = default; + NamespaceStatus? status = default; + bool? enabled = default; + bool? critical = default; + string subscriptionId = default; + string region = default; + string metricId = default; + DateTimeOffset? createdAt = default; + DateTimeOffset? updatedAt = default; + NotificationHubNamespaceType? namespaceType = default; + ReplicationRegion? replicationRegion = default; + ZoneRedundancyPreference? zoneRedundancy = default; + NetworkAcls networkAcls = default; + PnsCredentials pnsCredentials = default; + string serviceBusEndpoint = default; + IReadOnlyList privateEndpointConnections = default; + string scaleUnit = default; + string dataCenter = default; + PublicNetworkAccess? publicNetworkAccess = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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, options); + continue; + } + if (property.NameEquals("pnsCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pnsCredentials = PnsCredentials.DeserializePnsCredentials(property.Value, options); + 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, options)); + } + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new NamespaceProperties( + name, + provisioningState, + status, + enabled, + critical, + subscriptionId, + region, + metricId, + createdAt, + updatedAt, + namespaceType, + replicationRegion, + zoneRedundancy, + networkAcls, + pnsCredentials, + serviceBusEndpoint, + privateEndpointConnections ?? new ChangeTrackingList(), + scaleUnit, + dataCenter, + publicNetworkAccess, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NamespaceProperties)} does not support '{options.Format}' format."); + } + } + + NamespaceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNamespaceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NamespaceProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..6219f8393d49 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NamespaceProperties.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Represents namespace properties. + public partial class NamespaceProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NamespaceProperties() + { + PrivateEndpointConnections = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// 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. + /// Keeps track of any properties unknown to the library. + 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, IDictionary serializedAdditionalRawData) + { + 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; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// 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..c9fb5a03266d --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class NetworkAcls : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkAcls)} does not support '{format}' format."); + } + + 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); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + NetworkAcls IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkAcls)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkAcls(document.RootElement, options); + } + + internal static NetworkAcls DeserializeNetworkAcls(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList ipRules = default; + PublicInternetAuthorizationRule publicNetworkRule = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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, options)); + } + ipRules = array; + continue; + } + if (property.NameEquals("publicNetworkRule"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkRule = PublicInternetAuthorizationRule.DeserializePublicInternetAuthorizationRule(property.Value, options); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new NetworkAcls(ipRules ?? new ChangeTrackingList(), publicNetworkRule, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NetworkAcls)} does not support '{options.Format}' format."); + } + } + + NetworkAcls IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNetworkAcls(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkAcls)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..f016443ffedc --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NetworkAcls.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// A collection of network authorization rules. + public partial class NetworkAcls + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NetworkAcls() + { + IPRules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of IP rules. + /// A default (public Internet) network authorization rule, which contains rights if no other network rule matches. + /// Keeps track of any properties unknown to the library. + internal NetworkAcls(IList ipRules, PublicInternetAuthorizationRule publicNetworkRule, IDictionary serializedAdditionalRawData) + { + IPRules = ipRules; + PublicNetworkRule = publicNetworkRule; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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 ed17d1104a76..0a8b1232b46d 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 @@ -10,11 +10,10 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class NotificationHubAdmCredential : IUtf8JsonSerializable, IJsonModel + internal partial class NotificationHubAdmCredential : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); @@ -28,23 +27,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model 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); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -83,42 +66,14 @@ internal static NotificationHubAdmCredential DeserializeNotificationHubAdmCreden { return null; } - string clientId = default; - string clientSecret = default; - Uri authTokenUrl = default; + AdmCredentialProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); 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, options); continue; } if (options.Format != "W") @@ -127,7 +82,7 @@ internal static NotificationHubAdmCredential DeserializeNotificationHubAdmCreden } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubAdmCredential(clientId, clientSecret, authTokenUrl, serializedAdditionalRawData); + return new NotificationHubAdmCredential(properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) 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 53990f8bb8c8..727c47299db2 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAdmCredential.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { /// Description of a NotificationHub AdmCredential. - public partial class NotificationHubAdmCredential + internal partial class NotificationHubAdmCredential { /// /// Keeps track of any properties unknown to the library. @@ -46,28 +47,30 @@ public partial class NotificationHubAdmCredential private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public NotificationHubAdmCredential() + /// Description of a NotificationHub AdmCredential. + /// is null. + public NotificationHubAdmCredential(AdmCredentialProperties properties) { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; } /// Initializes a new instance of . - /// The client identifier. - /// The credential secret access key. - /// The URL of the authorization token. + /// Description of a NotificationHub AdmCredential. /// Keeps track of any properties unknown to the library. - internal NotificationHubAdmCredential(string clientId, string clientSecret, Uri authTokenUri, IDictionary serializedAdditionalRawData) + internal NotificationHubAdmCredential(AdmCredentialProperties properties, IDictionary serializedAdditionalRawData) { - ClientId = clientId; - ClientSecret = clientSecret; - AuthTokenUri = authTokenUri; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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; } + /// Initializes a new instance of for deserialization. + internal NotificationHubAdmCredential() + { + } + + /// 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 0805ea6fa98f..fa6a974212a2 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 @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { @@ -28,48 +27,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode 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); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -108,72 +66,14 @@ internal static NotificationHubApnsCredential DeserializeNotificationHubApnsCred { return null; } - string apnsCertificate = default; - string certificateKey = default; - Uri endpoint = default; - string thumbprint = default; - string keyId = default; - string appName = default; - string appId = default; - string token = default; + ApnsCredentialProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); 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, options); continue; } if (options.Format != "W") @@ -182,16 +82,7 @@ internal static NotificationHubApnsCredential DeserializeNotificationHubApnsCred } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubApnsCredential( - apnsCertificate, - certificateKey, - endpoint, - thumbprint, - keyId, - appName, - appId, - token, - serializedAdditionalRawData); + return new NotificationHubApnsCredential(properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) 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 f17a43c26334..c8038822a2bd 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubApnsCredential.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { @@ -46,48 +47,30 @@ public partial class NotificationHubApnsCredential private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public NotificationHubApnsCredential() + /// Description of a NotificationHub ApnsCredential. + /// is null. + public NotificationHubApnsCredential(ApnsCredentialProperties properties) { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; } /// Initializes a new instance of . - /// 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. + /// Description of a NotificationHub ApnsCredential. /// Keeps track of any properties unknown to the library. - internal NotificationHubApnsCredential(string apnsCertificate, string certificateKey, Uri endpoint, string thumbprintString, string keyId, string appName, string appId, string token, IDictionary serializedAdditionalRawData) + internal NotificationHubApnsCredential(ApnsCredentialProperties properties, IDictionary serializedAdditionalRawData) { - ApnsCertificate = apnsCertificate; - CertificateKey = certificateKey; - Endpoint = endpoint; - ThumbprintString = thumbprintString; - KeyId = keyId; - AppName = appName; - AppId = appId; - Token = token; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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; } + /// Initializes a new instance of for deserialization. + internal NotificationHubApnsCredential() + { + } + + /// Description of a NotificationHub ApnsCredential. + public ApnsCredentialProperties Properties { get; set; } } } 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 b4e3d76613f4..50e38a554e54 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 @@ -28,16 +28,16 @@ void IJsonModel.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); @@ -109,8 +109,8 @@ internal static NotificationHubAvailabilityContent DeserializeNotificationHubAva { return null; } - NotificationHubSku sku = default; bool? isAvailiable = default; + NotificationHubSku sku = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -121,22 +121,22 @@ internal static NotificationHubAvailabilityContent DeserializeNotificationHubAva Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) + if (property.NameEquals("isAvailiable"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); + isAvailiable = property.Value.GetBoolean(); continue; } - if (property.NameEquals("isAvailiable"u8)) + if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - isAvailiable = property.Value.GetBoolean(); + sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -195,8 +195,8 @@ internal static NotificationHubAvailabilityContent DeserializeNotificationHubAva systemData, tags ?? new ChangeTrackingDictionary(), location, - sku, isAvailiable, + sku, serializedAdditionalRawData); } 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 69f838f5e2fa..becff791c164 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityContent.cs @@ -12,7 +12,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 { /// @@ -60,13 +63,13 @@ public NotificationHubAvailabilityContent(AzureLocation location) : base(locatio /// The systemData. /// The tags. /// The location. - /// The sku of the created namespace. - /// 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. + /// The Sku description for a namespace. /// Keeps track of any properties unknown to the library. - internal NotificationHubAvailabilityContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NotificationHubSku sku, bool? isAvailiable, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal NotificationHubAvailabilityContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, bool? isAvailiable, NotificationHubSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { - Sku = sku; IsAvailiable = isAvailiable; + Sku = sku; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -75,9 +78,9 @@ internal NotificationHubAvailabilityContent() { } - /// 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 bc4f1f4de549..04245c3ecbe3 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubAvailabilityResult.cs @@ -60,8 +60,11 @@ 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. /// Keeps track of any properties unknown to the library. internal NotificationHubAvailabilityResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, bool? isAvailiable, NotificationHubSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { @@ -75,9 +78,12 @@ internal NotificationHubAvailabilityResult() { } - /// 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 7d44a62335ae..51d72e3e9b8d 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 @@ -10,11 +10,10 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class NotificationHubBaiduCredential : IUtf8JsonSerializable, IJsonModel + internal partial class NotificationHubBaiduCredential : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); @@ -28,23 +27,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod 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); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -83,42 +66,14 @@ internal static NotificationHubBaiduCredential DeserializeNotificationHubBaiduCr { return null; } - string baiduApiKey = default; - Uri baiduEndPoint = default; - string baiduSecretKey = default; + BaiduCredentialProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); 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, options); continue; } if (options.Format != "W") @@ -127,7 +82,7 @@ internal static NotificationHubBaiduCredential DeserializeNotificationHubBaiduCr } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubBaiduCredential(baiduApiKey, baiduEndPoint, baiduSecretKey, serializedAdditionalRawData); + return new NotificationHubBaiduCredential(properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) 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 7a92ba635b5e..f5cb4293eb3e 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubBaiduCredential.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { /// Description of a NotificationHub BaiduCredential. - public partial class NotificationHubBaiduCredential + internal partial class NotificationHubBaiduCredential { /// /// Keeps track of any properties unknown to the library. @@ -46,28 +47,30 @@ public partial class NotificationHubBaiduCredential private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public NotificationHubBaiduCredential() + /// Description of a NotificationHub BaiduCredential. + /// is null. + public NotificationHubBaiduCredential(BaiduCredentialProperties properties) { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; } /// Initializes a new instance of . - /// Baidu Api Key. - /// Baidu Endpoint. - /// Baidu Secret Key. + /// Description of a NotificationHub BaiduCredential. /// Keeps track of any properties unknown to the library. - internal NotificationHubBaiduCredential(string baiduApiKey, Uri baiduEndpoint, string baiduSecretKey, IDictionary serializedAdditionalRawData) + internal NotificationHubBaiduCredential(BaiduCredentialProperties properties, IDictionary serializedAdditionalRawData) { - BaiduApiKey = baiduApiKey; - BaiduEndpoint = baiduEndpoint; - BaiduSecretKey = baiduSecretKey; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Baidu Api Key. - public string BaiduApiKey { get; set; } - /// Baidu Endpoint. - public Uri BaiduEndpoint { get; set; } - /// Baidu Secret Key. - public string BaiduSecretKey { get; set; } + /// Initializes a new instance of for deserialization. + internal NotificationHubBaiduCredential() + { + } + + /// 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 a4058d789b9e..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.Serialization.cs +++ /dev/null @@ -1,383 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NotificationHubs; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - public partial class NotificationHubCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NotificationHubCreateOrUpdateContent)} does not support '{format}' format."); - } - - 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); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } - 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(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); - } - - NotificationHubCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NotificationHubCreateOrUpdateContent)} does not support '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNotificationHubCreateOrUpdateContent(document.RootElement, options); - } - - internal static NotificationHubCreateOrUpdateContent DeserializeNotificationHubCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= new ModelReaderWriterOptions("W"); - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - NotificationHubSku sku = default; - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string name0 = default; - TimeSpan? registrationTtl = default; - IList authorizationRules = default; - NotificationHubApnsCredential apnsCredential = default; - NotificationHubWnsCredential wnsCredential = default; - NotificationHubGcmCredential gcmCredential = default; - NotificationHubMpnsCredential mpnsCredential = default; - NotificationHubAdmCredential admCredential = default; - NotificationHubBaiduCredential baiduCredential = default; - IDictionary serializedAdditionalRawData = default; - Dictionary additionalPropertiesDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sku"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); - 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, options)); - } - authorizationRules = array; - continue; - } - if (property0.NameEquals("apnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("wnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("gcmCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("mpnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("admCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("baiduCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property0.Value, options); - continue; - } - } - continue; - } - if (options.Format != "W") - { - additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubCreateOrUpdateContent( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - name0, - registrationTtl, - authorizationRules ?? new ChangeTrackingList(), - apnsCredential, - wnsCredential, - gcmCredential, - mpnsCredential, - admCredential, - baiduCredential, - sku, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(NotificationHubCreateOrUpdateContent)} does not support '{options.Format}' format."); - } - } - - NotificationHubCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeNotificationHubCreateOrUpdateContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NotificationHubCreateOrUpdateContent)} does not support '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} 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 d3a2504922b0..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubCreateOrUpdateContent.cs +++ /dev/null @@ -1,117 +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; -using Azure.ResourceManager.NotificationHubs; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - /// Parameters supplied to the CreateOrUpdate NotificationHub operation. - public partial class NotificationHubCreateOrUpdateContent : TrackedResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The location. - public NotificationHubCreateOrUpdateContent(AzureLocation location) : base(location) - { - AuthorizationRules = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// 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. - /// Keeps track of any properties unknown to the library. - 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, IDictionary serializedAdditionalRawData) : 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; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NotificationHubCreateOrUpdateContent() - { - } - - /// 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/NotificationHubGcmCredential.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.Serialization.cs index b1e2a55d2bd3..3e2ff177fccb 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 @@ -10,11 +10,10 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class NotificationHubGcmCredential : IUtf8JsonSerializable, IJsonModel + internal partial class NotificationHubGcmCredential : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); @@ -28,18 +27,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model 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); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -78,36 +66,14 @@ internal static NotificationHubGcmCredential DeserializeNotificationHubGcmCreden { return null; } - Uri gcmEndpoint = default; - string googleApiKey = default; + GcmCredentialProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); 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, options); continue; } if (options.Format != "W") @@ -116,7 +82,7 @@ internal static NotificationHubGcmCredential DeserializeNotificationHubGcmCreden } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubGcmCredential(gcmEndpoint, googleApiKey, serializedAdditionalRawData); + return new NotificationHubGcmCredential(properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) 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 8d469ebfc678..c743c496c198 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubGcmCredential.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { /// Description of a NotificationHub GcmCredential. - public partial class NotificationHubGcmCredential + internal partial class NotificationHubGcmCredential { /// /// Keeps track of any properties unknown to the library. @@ -46,24 +47,30 @@ public partial class NotificationHubGcmCredential private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public NotificationHubGcmCredential() + /// Description of a NotificationHub GcmCredential. + /// is null. + public NotificationHubGcmCredential(GcmCredentialProperties properties) { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; } /// Initializes a new instance of . - /// The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send'. - /// The Google API key. + /// Description of a NotificationHub GcmCredential. /// Keeps track of any properties unknown to the library. - internal NotificationHubGcmCredential(Uri gcmEndpoint, string gcmApiKey, IDictionary serializedAdditionalRawData) + internal NotificationHubGcmCredential(GcmCredentialProperties properties, IDictionary serializedAdditionalRawData) { - GcmEndpoint = gcmEndpoint; - GcmApiKey = gcmApiKey; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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; } + /// Initializes a new instance of for deserialization. + internal NotificationHubGcmCredential() + { + } + + /// Description of a NotificationHub GcmCredential. + public GcmCredentialProperties Properties { get; set; } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.Serialization.cs index 6a2d0a096e0a..4dbeb14b32e2 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.Serialization.cs @@ -27,7 +27,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea } writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Value)) + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -37,7 +37,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea } writer.WriteEndArray(); } - if (Optional.IsDefined(NextLink)) + if (options.Format != "W" && Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink); 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 3dd36af81703..97ab60760fd3 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubListResult.cs @@ -53,8 +53,8 @@ internal NotificationHubListResult() } /// Initializes a new instance of . - /// 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. /// Keeps track of any properties unknown to the library. internal NotificationHubListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) { @@ -63,9 +63,9 @@ internal NotificationHubListResult(IReadOnlyList value, str _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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 8a81b52c12b8..cfd7a2f28d1e 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 @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { @@ -28,23 +27,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode 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); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -83,38 +66,14 @@ internal static NotificationHubMpnsCredential DeserializeNotificationHubMpnsCred { return null; } - string mpnsCertificate = default; - string certificateKey = default; - string thumbprint = default; + MpnsCredentialProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); 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, options); continue; } if (options.Format != "W") @@ -123,7 +82,7 @@ internal static NotificationHubMpnsCredential DeserializeNotificationHubMpnsCred } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubMpnsCredential(mpnsCertificate, certificateKey, thumbprint, serializedAdditionalRawData); + return new NotificationHubMpnsCredential(properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) 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 4f255348ae8d..061efc3f798f 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubMpnsCredential.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { @@ -46,28 +47,30 @@ public partial class NotificationHubMpnsCredential private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public NotificationHubMpnsCredential() + /// Description of a NotificationHub MpnsCredential. + /// is null. + public NotificationHubMpnsCredential(MpnsCredentialProperties properties) { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; } /// Initializes a new instance of . - /// The MPNS certificate. - /// The certificate key for this credential. - /// The MPNS certificate Thumbprint. + /// Description of a NotificationHub MpnsCredential. /// Keeps track of any properties unknown to the library. - internal NotificationHubMpnsCredential(string mpnsCertificate, string certificateKey, string thumbprintString, IDictionary serializedAdditionalRawData) + internal NotificationHubMpnsCredential(MpnsCredentialProperties properties, IDictionary serializedAdditionalRawData) { - MpnsCertificate = mpnsCertificate; - CertificateKey = certificateKey; - ThumbprintString = thumbprintString; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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; } + /// Initializes a new instance of for deserialization. + internal NotificationHubMpnsCredential() + { + } + + /// 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 9b59c5e190b7..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.Serialization.cs +++ /dev/null @@ -1,425 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NotificationHubs; - -namespace Azure.ResourceManager.NotificationHubs.Models -{ - public partial class NotificationHubNamespaceCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NotificationHubNamespaceCreateOrUpdateContent)} does not support '{format}' format."); - } - - 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); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } - 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 (options.Format != "W" && Optional.IsDefined(MetricId)) - { - writer.WritePropertyName("metricId"u8); - writer.WriteStringValue(MetricId); - } - 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(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); - } - - NotificationHubNamespaceCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NotificationHubNamespaceCreateOrUpdateContent)} does not support '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNotificationHubNamespaceCreateOrUpdateContent(document.RootElement, options); - } - - internal static NotificationHubNamespaceCreateOrUpdateContent DeserializeNotificationHubNamespaceCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= new ModelReaderWriterOptions("W"); - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - NotificationHubSku sku = default; - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string name0 = default; - string provisioningState = default; - string region = default; - string metricId = default; - string status = default; - DateTimeOffset? createdAt = default; - DateTimeOffset? updatedAt = default; - Uri serviceBusEndpoint = default; - string subscriptionId = default; - string scaleUnit = default; - bool? enabled = default; - bool? critical = default; - string dataCenter = default; - NotificationHubNamespaceType? namespaceType = default; - IDictionary serializedAdditionalRawData = default; - Dictionary additionalPropertiesDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sku"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); - 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; - } - if (options.Format != "W") - { - additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubNamespaceCreateOrUpdateContent( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - name0, - provisioningState, - region, - metricId, - status, - createdAt, - updatedAt, - serviceBusEndpoint, - subscriptionId, - scaleUnit, - enabled, - critical, - dataCenter, - namespaceType, - sku, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(NotificationHubNamespaceCreateOrUpdateContent)} does not support '{options.Format}' format."); - } - } - - NotificationHubNamespaceCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeNotificationHubNamespaceCreateOrUpdateContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NotificationHubNamespaceCreateOrUpdateContent)} does not support '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} 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 a323f7d740fb..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceCreateOrUpdateContent.cs +++ /dev/null @@ -1,135 +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 - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The location. - public NotificationHubNamespaceCreateOrUpdateContent(AzureLocation location) : base(location) - { - } - - /// Initializes a new instance of . - /// 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. - /// Keeps track of any properties unknown to the library. - 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, IDictionary serializedAdditionalRawData) : 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; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NotificationHubNamespaceCreateOrUpdateContent() - { - } - - /// 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/NotificationHubNamespaceListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.Serialization.cs index ae0936e30dd9..3c42c293f315 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.Serialization.cs @@ -27,7 +27,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, } writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Value)) + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -37,7 +37,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, } writer.WriteEndArray(); } - if (Optional.IsDefined(NextLink)) + if (options.Format != "W" && Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink); 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 1dcf4d1d163d..400bb2fa758e 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespaceListResult.cs @@ -53,8 +53,8 @@ internal NotificationHubNamespaceListResult() } /// Initializes a new instance of . - /// 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. /// Keeps track of any properties unknown to the library. internal NotificationHubNamespaceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) { @@ -63,9 +63,9 @@ internal NotificationHubNamespaceListResult(IReadOnlyList 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 039e1c3af1cf..bfa51e666f41 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 @@ -27,6 +27,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode } 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); @@ -38,11 +48,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode } writer.WriteEndObject(); } - if (Optional.IsDefined(Sku)) - { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); - } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -81,33 +86,43 @@ internal static NotificationHubNamespacePatch DeserializeNotificationHubNamespac { return null; } - IDictionary tags = default; NotificationHubSku sku = default; + NamespaceProperties properties = default; + IDictionary tags = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) { - dictionary.Add(property0.Name, property0.Value.GetString()); + continue; } - tags = dictionary; + properties = NamespaceProperties.DeserializeNamespaceProperties(property.Value, options); continue; } - if (property.NameEquals("sku"u8)) + if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; continue; } if (options.Format != "W") @@ -116,7 +131,7 @@ internal static NotificationHubNamespacePatch DeserializeNotificationHubNamespac } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubNamespacePatch(tags ?? new ChangeTrackingDictionary(), sku, serializedAdditionalRawData); + return new NotificationHubNamespacePatch(sku, properties, tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) 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 80390e45a2ae..a895a4de7b9c 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubNamespacePatch.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - /// Parameters supplied to the Patch Namespace operation. + /// Patch parameter for NamespaceResource. public partial class NotificationHubNamespacePatch { /// @@ -53,19 +53,23 @@ public NotificationHubNamespacePatch() } /// Initializes a new instance of . - /// Resource tags. - /// The sku of the created namespace. + /// The Sku description for a namespace. + /// Represents namespace properties. + /// Dictionary of <string>. /// Keeps track of any properties unknown to the library. - internal NotificationHubNamespacePatch(IDictionary tags, NotificationHubSku sku, IDictionary serializedAdditionalRawData) + internal NotificationHubNamespacePatch(NotificationHubSku sku, NamespaceProperties properties, IDictionary tags, IDictionary serializedAdditionalRawData) { - Tags = tags; Sku = sku; + Properties = properties; + Tags = tags; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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 78e52d9d550f..5e604b6c9dfe 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 @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Models; using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models @@ -28,6 +27,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr } writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -44,81 +48,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr } writer.WriteEndObject(); } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } - 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(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -157,170 +86,43 @@ internal static NotificationHubPatch DeserializeNotificationHubPatch(JsonElement { return null; } + NotificationHubProperties properties = default; NotificationHubSku sku = default; IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string name0 = default; - TimeSpan? registrationTtl = default; - IList authorizationRules = default; - NotificationHubApnsCredential apnsCredential = default; - NotificationHubWnsCredential wnsCredential = default; - NotificationHubGcmCredential gcmCredential = default; - NotificationHubMpnsCredential mpnsCredential = default; - NotificationHubAdmCredential admCredential = default; - NotificationHubBaiduCredential baiduCredential = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); - continue; - } - if (property.NameEquals("tags"u8)) + if (property.NameEquals("properties"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()); + properties = NotificationHubProperties.DeserializeNotificationHubProperties(property.Value, options); 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.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } + Dictionary dictionary = new Dictionary(); 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, options)); - } - authorizationRules = array; - continue; - } - if (property0.NameEquals("apnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("wnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("gcmCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("mpnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("admCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("baiduCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property0.Value, options); - continue; - } + dictionary.Add(property0.Name, property0.Value.GetString()); } + tags = dictionary; continue; } if (options.Format != "W") @@ -329,24 +131,7 @@ internal static NotificationHubPatch DeserializeNotificationHubPatch(JsonElement } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubPatch( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - name0, - registrationTtl, - authorizationRules ?? new ChangeTrackingList(), - apnsCredential, - wnsCredential, - gcmCredential, - mpnsCredential, - admCredential, - baiduCredential, - sku, - serializedAdditionalRawData); + return new NotificationHubPatch(properties, sku, tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) 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 3b50181bedef..a01fc8353ea5 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPatch.cs @@ -7,14 +7,12 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; using Azure.ResourceManager.NotificationHubs; 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 { /// /// Keeps track of any properties unknown to the library. @@ -49,69 +47,29 @@ public partial class NotificationHubPatch : TrackedResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// The location. - public NotificationHubPatch(AzureLocation location) : base(location) + public NotificationHubPatch() { - AuthorizationRules = new ChangeTrackingList(); + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . - /// 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. + /// NotificationHub properties. + /// The Sku description for a namespace. + /// Dictionary of <string>. /// Keeps track of any properties unknown to the library. - 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, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal NotificationHubPatch(NotificationHubProperties properties, NotificationHubSku sku, IDictionary tags, IDictionary serializedAdditionalRawData) { - NotificationHubName = notificationHubName; - RegistrationTtl = registrationTtl; - AuthorizationRules = authorizationRules; - ApnsCredential = apnsCredential; - WnsCredential = wnsCredential; - GcmCredential = gcmCredential; - MpnsCredential = mpnsCredential; - AdmCredential = admCredential; - BaiduCredential = baiduCredential; + Properties = properties; Sku = sku; + Tags = tags; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal NotificationHubPatch() - { - } - - /// 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 8e286bbb9b9a..e10b795a330a 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 @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode } 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)) { @@ -66,39 +66,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode writer.WritePropertyName("systemData"u8); JsonSerializer.Serialize(writer, SystemData); } - 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(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -137,30 +104,24 @@ internal static NotificationHubPnsCredentials DeserializeNotificationHubPnsCrede { return null; } - NotificationHubSku sku = default; + PnsCredentials properties = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - NotificationHubApnsCredential apnsCredential = default; - NotificationHubWnsCredential wnsCredential = default; - NotificationHubGcmCredential gcmCredential = default; - NotificationHubMpnsCredential mpnsCredential = default; - NotificationHubAdmCredential admCredential = default; - NotificationHubBaiduCredential baiduCredential = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); 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, options); + properties = PnsCredentials.DeserializePnsCredentials(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -206,72 +167,6 @@ 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, options); - continue; - } - if (property0.NameEquals("wnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("gcmCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("mpnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("admCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("baiduCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property0.Value, options); - continue; - } - } - continue; - } if (options.Format != "W") { additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -285,13 +180,7 @@ internal static NotificationHubPnsCredentials DeserializeNotificationHubPnsCrede systemData, tags ?? new ChangeTrackingDictionary(), location, - apnsCredential, - wnsCredential, - gcmCredential, - mpnsCredential, - admCredential, - baiduCredential, - sku, + properties, serializedAdditionalRawData); } 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 269322cf82b6..7c613fff5e04 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPnsCredentials.cs @@ -12,7 +12,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 { /// @@ -60,23 +63,11 @@ 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. + /// Collection of Notification Hub or Notification Hub Namespace PNS credentials. /// Keeps track of any properties unknown to the library. - 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, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal NotificationHubPnsCredentials(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PnsCredentials properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { - ApnsCredential = apnsCredential; - WnsCredential = wnsCredential; - GcmCredential = gcmCredential; - MpnsCredential = mpnsCredential; - AdmCredential = admCredential; - BaiduCredential = baiduCredential; - Sku = sku; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,19 +76,7 @@ internal NotificationHubPnsCredentials() { } - /// 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/NotificationHubProperties.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.Serialization.cs new file mode 100644 index 000000000000..1160e599d0f4 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.Serialization.cs @@ -0,0 +1,323 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class NotificationHubProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationHubProperties)} does not support '{format}' format."); + } + + 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 (options.Format != "W" && 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); + } + 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); + } + if (options.Format != "W" && Optional.IsDefined(DailyMaxActiveDevices)) + { + writer.WritePropertyName("dailyMaxActiveDevices"u8); + writer.WriteNumberValue(DailyMaxActiveDevices.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + NotificationHubProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationHubProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNotificationHubProperties(document.RootElement, options); + } + + internal static NotificationHubProperties DeserializeNotificationHubProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string registrationTtl = default; + IReadOnlyList authorizationRules = default; + NotificationHubApnsCredential apnsCredential = default; + NotificationHubWnsCredential wnsCredential = default; + NotificationHubGcmCredential gcmCredential = default; + NotificationHubMpnsCredential mpnsCredential = default; + NotificationHubAdmCredential admCredential = default; + NotificationHubBaiduCredential baiduCredential = default; + BrowserCredential browserCredential = default; + XiaomiCredential xiaomiCredential = default; + FcmV1Credential fcmV1Credential = default; + long? dailyMaxActiveDevices = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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, options)); + } + authorizationRules = array; + continue; + } + if (property.NameEquals("apnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property.Value, options); + continue; + } + if (property.NameEquals("wnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property.Value, options); + continue; + } + if (property.NameEquals("gcmCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property.Value, options); + continue; + } + if (property.NameEquals("mpnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property.Value, options); + continue; + } + if (property.NameEquals("admCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property.Value, options); + continue; + } + if (property.NameEquals("baiduCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property.Value, options); + continue; + } + if (property.NameEquals("browserCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + browserCredential = BrowserCredential.DeserializeBrowserCredential(property.Value, options); + continue; + } + if (property.NameEquals("xiaomiCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + xiaomiCredential = XiaomiCredential.DeserializeXiaomiCredential(property.Value, options); + continue; + } + if (property.NameEquals("fcmV1Credential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fcmV1Credential = FcmV1Credential.DeserializeFcmV1Credential(property.Value, options); + continue; + } + if (property.NameEquals("dailyMaxActiveDevices"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dailyMaxActiveDevices = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new NotificationHubProperties( + name, + registrationTtl, + authorizationRules ?? new ChangeTrackingList(), + apnsCredential, + wnsCredential, + gcmCredential, + mpnsCredential, + admCredential, + baiduCredential, + browserCredential, + xiaomiCredential, + fcmV1Credential, + dailyMaxActiveDevices, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NotificationHubProperties)} does not support '{options.Format}' format."); + } + } + + NotificationHubProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNotificationHubProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NotificationHubProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..09dafa2eb585 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubProperties.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// NotificationHub properties. + public partial class NotificationHubProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NotificationHubProperties() + { + AuthorizationRules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// 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. + /// + /// Keeps track of any properties unknown to the library. + 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, IDictionary serializedAdditionalRawData) + { + 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; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubResourceKeys.Serialization.cs index 3ec615ddbab0..bb00df02958e 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubResourceKeys.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubResourceKeys.Serialization.cs @@ -27,27 +27,27 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR } writer.WriteStartObject(); - if (Optional.IsDefined(PrimaryConnectionString)) + if (options.Format != "W" && Optional.IsDefined(PrimaryConnectionString)) { writer.WritePropertyName("primaryConnectionString"u8); writer.WriteStringValue(PrimaryConnectionString); } - if (Optional.IsDefined(SecondaryConnectionString)) + if (options.Format != "W" && Optional.IsDefined(SecondaryConnectionString)) { writer.WritePropertyName("secondaryConnectionString"u8); writer.WriteStringValue(SecondaryConnectionString); } - if (Optional.IsDefined(PrimaryKey)) + if (options.Format != "W" && Optional.IsDefined(PrimaryKey)) { writer.WritePropertyName("primaryKey"u8); writer.WriteStringValue(PrimaryKey); } - if (Optional.IsDefined(SecondaryKey)) + if (options.Format != "W" && Optional.IsDefined(SecondaryKey)) { writer.WritePropertyName("secondaryKey"u8); writer.WriteStringValue(SecondaryKey); } - if (Optional.IsDefined(KeyName)) + if (options.Format != "W" && Optional.IsDefined(KeyName)) { writer.WritePropertyName("keyName"u8); writer.WriteStringValue(KeyName); 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 80ee27c6fbe1..bd2fe9e2f979 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubResourceKeys.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubResourceKeys.cs @@ -10,7 +10,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 { /// @@ -51,11 +51,14 @@ internal NotificationHubResourceKeys() } /// Initializes a new instance of . - /// 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. /// Keeps track of any properties unknown to the library. internal NotificationHubResourceKeys(string primaryConnectionString, string secondaryConnectionString, string primaryKey, string secondaryKey, string keyName, IDictionary serializedAdditionalRawData) { @@ -67,15 +70,18 @@ internal NotificationHubResourceKeys(string primaryConnectionString, string seco _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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 0238fe9c550b..cc1f07c9bc8e 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSku.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubSku.cs @@ -46,18 +46,18 @@ public partial class NotificationHubSku private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// Name of the notification hub sku. + /// Namespace SKU name. public NotificationHubSku(NotificationHubSkuName name) { Name = name; } /// Initializes a new instance of . - /// 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. /// Keeps track of any properties unknown to the library. internal NotificationHubSku(NotificationHubSkuName name, string tier, string size, string family, int? capacity, IDictionary serializedAdditionalRawData) { @@ -74,15 +74,15 @@ internal NotificationHubSku() { } - /// 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 41721a9b0b93..02e09bc346e6 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 @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode } 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)) { @@ -66,31 +66,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode writer.WritePropertyName("systemData"u8); JsonSerializer.Serialize(writer, SystemData); } - 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(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -129,27 +104,24 @@ internal static NotificationHubTestSendResult DeserializeNotificationHubTestSend { return null; } - NotificationHubSku sku = default; + DebugSendResult properties = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - int? success = default; - int? failure = default; - BinaryData results = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); 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, options); + properties = DebugSendResult.DeserializeDebugSendResult(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -195,45 +167,6 @@ 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; - } if (options.Format != "W") { additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -247,10 +180,7 @@ internal static NotificationHubTestSendResult DeserializeNotificationHubTestSend systemData, tags ?? new ChangeTrackingDictionary(), location, - success, - failure, - results, - sku, + properties, serializedAdditionalRawData); } 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 db535480306d..aae63ed1789d 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubTestSendResult.cs @@ -60,17 +60,11 @@ 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. + /// Result of DebugSend operations. /// Keeps track of any properties unknown to the library. - internal NotificationHubTestSendResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, int? success, int? failure, BinaryData results, NotificationHubSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal NotificationHubTestSendResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DebugSendResult properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { - Success = success; - Failure = failure; - Results = results; - Sku = sku; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -79,42 +73,7 @@ internal NotificationHubTestSendResult() { } - /// 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 de04491bedb9..2d936f557162 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 @@ -10,11 +10,10 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class NotificationHubWnsCredential : IUtf8JsonSerializable, IJsonModel + internal partial class NotificationHubWnsCredential : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); @@ -28,23 +27,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model 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); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -83,42 +66,14 @@ internal static NotificationHubWnsCredential DeserializeNotificationHubWnsCreden { return null; } - string packageSid = default; - string secretKey = default; - Uri windowsLiveEndpoint = default; + WnsCredentialProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); 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, options); continue; } if (options.Format != "W") @@ -127,7 +82,7 @@ internal static NotificationHubWnsCredential DeserializeNotificationHubWnsCreden } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubWnsCredential(packageSid, secretKey, windowsLiveEndpoint, serializedAdditionalRawData); + return new NotificationHubWnsCredential(properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) 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 f8e3ebb9f7a5..40868d003444 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubWnsCredential.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { /// Description of a NotificationHub WnsCredential. - public partial class NotificationHubWnsCredential + internal partial class NotificationHubWnsCredential { /// /// Keeps track of any properties unknown to the library. @@ -46,28 +47,30 @@ public partial class NotificationHubWnsCredential private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public NotificationHubWnsCredential() + /// Description of a NotificationHub WnsCredential. + /// is null. + public NotificationHubWnsCredential(WnsCredentialProperties properties) { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; } /// Initializes a new instance of . - /// The package ID for this credential. - /// The secret key. - /// The Windows Live endpoint. + /// Description of a NotificationHub WnsCredential. /// Keeps track of any properties unknown to the library. - internal NotificationHubWnsCredential(string packageSid, string secretKey, Uri windowsLiveEndpoint, IDictionary serializedAdditionalRawData) + internal NotificationHubWnsCredential(WnsCredentialProperties properties, IDictionary serializedAdditionalRawData) { - PackageSid = packageSid; - SecretKey = secretKey; - WindowsLiveEndpoint = windowsLiveEndpoint; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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; } + /// Initializes a new instance of for deserialization. + internal NotificationHubWnsCredential() + { + } + + /// 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/NotificationHubsPrivateLinkResourceListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.Serialization.cs new file mode 100644 index 000000000000..ea2e3401d5a2 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class NotificationHubsPrivateLinkResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceListResult)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + NotificationHubsPrivateLinkResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceListResult)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNotificationHubsPrivateLinkResourceListResult(document.RootElement, options); + } + + internal static NotificationHubsPrivateLinkResourceListResult DeserializeNotificationHubsPrivateLinkResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NotificationHubsPrivateLinkResourceData.DeserializeNotificationHubsPrivateLinkResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new NotificationHubsPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceListResult)} does not support '{options.Format}' format."); + } + } + + NotificationHubsPrivateLinkResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNotificationHubsPrivateLinkResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceListResult)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..b4738e9834c2 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceListResult.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// The response of the List Private Link Resources operation. + internal partial class NotificationHubsPrivateLinkResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal NotificationHubsPrivateLinkResourceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Gets or sets result of the List AuthorizationRules operation. + /// Gets or sets link to the next set of results. + /// Keeps track of any properties unknown to the library. + internal NotificationHubsPrivateLinkResourceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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..37fc037438dd --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class NotificationHubsPrivateLinkResourceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceProperties)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) + { + writer.WritePropertyName("requiredMembers"u8); + writer.WriteStartArray(); + foreach (var item in RequiredMembers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(RequiredZoneNames)) + { + writer.WritePropertyName("requiredZoneNames"u8); + writer.WriteStartArray(); + foreach (var item in RequiredZoneNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + NotificationHubsPrivateLinkResourceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNotificationHubsPrivateLinkResourceProperties(document.RootElement, options); + } + + internal static NotificationHubsPrivateLinkResourceProperties DeserializeNotificationHubsPrivateLinkResourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string groupId = default; + IReadOnlyList requiredMembers = default; + IReadOnlyList requiredZoneNames = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new NotificationHubsPrivateLinkResourceProperties(groupId, requiredMembers ?? new ChangeTrackingList(), requiredZoneNames ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceProperties)} does not support '{options.Format}' format."); + } + } + + NotificationHubsPrivateLinkResourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNotificationHubsPrivateLinkResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..66e0e4014c06 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubsPrivateLinkResourceProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Represents properties of Private Link Resource. + public partial class NotificationHubsPrivateLinkResourceProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NotificationHubsPrivateLinkResourceProperties() + { + RequiredMembers = new ChangeTrackingList(); + RequiredZoneNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// 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. + /// Keeps track of any properties unknown to the library. + internal NotificationHubsPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, IDictionary serializedAdditionalRawData) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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..562a68064504 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.Serialization.cs @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class PnsCredentials : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PnsCredentials)} does not support '{format}' format."); + } + + 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); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PnsCredentials IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PnsCredentials)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePnsCredentials(document.RootElement, options); + } + + internal static PnsCredentials DeserializePnsCredentials(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NotificationHubAdmCredential admCredential = default; + NotificationHubApnsCredential apnsCredential = default; + NotificationHubBaiduCredential baiduCredential = default; + BrowserCredential browserCredential = default; + NotificationHubGcmCredential gcmCredential = default; + NotificationHubMpnsCredential mpnsCredential = default; + NotificationHubWnsCredential wnsCredential = default; + XiaomiCredential xiaomiCredential = default; + FcmV1Credential fcmV1Credential = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("admCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property.Value, options); + continue; + } + if (property.NameEquals("apnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property.Value, options); + continue; + } + if (property.NameEquals("baiduCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property.Value, options); + continue; + } + if (property.NameEquals("browserCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + browserCredential = BrowserCredential.DeserializeBrowserCredential(property.Value, options); + continue; + } + if (property.NameEquals("gcmCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property.Value, options); + continue; + } + if (property.NameEquals("mpnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property.Value, options); + continue; + } + if (property.NameEquals("wnsCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property.Value, options); + continue; + } + if (property.NameEquals("xiaomiCredential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + xiaomiCredential = XiaomiCredential.DeserializeXiaomiCredential(property.Value, options); + continue; + } + if (property.NameEquals("fcmV1Credential"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fcmV1Credential = FcmV1Credential.DeserializeFcmV1Credential(property.Value, options); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new PnsCredentials( + admCredential, + apnsCredential, + baiduCredential, + browserCredential, + gcmCredential, + mpnsCredential, + wnsCredential, + xiaomiCredential, + fcmV1Credential, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PnsCredentials)} does not support '{options.Format}' format."); + } + } + + PnsCredentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePnsCredentials(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PnsCredentials)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..b22cd6dd61a0 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PnsCredentials.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Collection of Notification Hub or Notification Hub Namespace PNS credentials. + public partial class PnsCredentials + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PnsCredentials() + { + } + + /// Initializes a new instance of . + /// 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. + /// Keeps track of any properties unknown to the library. + internal PnsCredentials(NotificationHubAdmCredential admCredential, NotificationHubApnsCredential apnsCredential, NotificationHubBaiduCredential baiduCredential, BrowserCredential browserCredential, NotificationHubGcmCredential gcmCredential, NotificationHubMpnsCredential mpnsCredential, NotificationHubWnsCredential wnsCredential, XiaomiCredential xiaomiCredential, FcmV1Credential fcmV1Credential, IDictionary serializedAdditionalRawData) + { + AdmCredential = admCredential; + ApnsCredential = apnsCredential; + BaiduCredential = baiduCredential; + BrowserCredential = browserCredential; + GcmCredential = gcmCredential; + MpnsCredential = mpnsCredential; + WnsCredential = wnsCredential; + XiaomiCredential = xiaomiCredential; + FcmV1Credential = fcmV1Credential; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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/NotificationHubPolicyKey.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.Serialization.cs similarity index 56% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.Serialization.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.Serialization.cs index 6fd5b8387164..375dc55e54f5 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.Serialization.cs @@ -10,28 +10,24 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models { - public partial class NotificationHubPolicyKey : IUtf8JsonSerializable, IJsonModel + public partial class PolicyKeyResource : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NotificationHubPolicyKey)} does not support '{format}' format."); + throw new FormatException($"The model {nameof(PolicyKeyResource)} does not support '{format}' format."); } writer.WriteStartObject(); - if (Optional.IsDefined(PolicyKey)) - { - writer.WritePropertyName("policyKey"u8); - writer.WriteStringValue(PolicyKey); - } + writer.WritePropertyName("policyKey"u8); + writer.WriteStringValue(PolicyKey.ToString()); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -50,19 +46,19 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead writer.WriteEndObject(); } - NotificationHubPolicyKey IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PolicyKeyResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NotificationHubPolicyKey)} does not support '{format}' format."); + throw new FormatException($"The model {nameof(PolicyKeyResource)} does not support '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNotificationHubPolicyKey(document.RootElement, options); + return DeserializePolicyKeyResource(document.RootElement, options); } - internal static NotificationHubPolicyKey DeserializeNotificationHubPolicyKey(JsonElement element, ModelReaderWriterOptions options = null) + internal static PolicyKeyResource DeserializePolicyKeyResource(JsonElement element, ModelReaderWriterOptions options = null) { options ??= new ModelReaderWriterOptions("W"); @@ -70,14 +66,14 @@ internal static NotificationHubPolicyKey DeserializeNotificationHubPolicyKey(Jso { return null; } - string policyKey = default; + PolicyKeyType policyKey = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("policyKey"u8)) { - policyKey = property.Value.GetString(); + policyKey = new PolicyKeyType(property.Value.GetString()); continue; } if (options.Format != "W") @@ -86,38 +82,38 @@ internal static NotificationHubPolicyKey DeserializeNotificationHubPolicyKey(Jso } } serializedAdditionalRawData = additionalPropertiesDictionary; - return new NotificationHubPolicyKey(policyKey, serializedAdditionalRawData); + return new PolicyKeyResource(policyKey, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(NotificationHubPolicyKey)} does not support '{options.Format}' format."); + throw new FormatException($"The model {nameof(PolicyKeyResource)} does not support '{options.Format}' format."); } } - NotificationHubPolicyKey IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PolicyKeyResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeNotificationHubPolicyKey(document.RootElement, options); + return DeserializePolicyKeyResource(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(NotificationHubPolicyKey)} does not support '{options.Format}' format."); + throw new FormatException($"The model {nameof(PolicyKeyResource)} does not support '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.cs similarity index 66% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.cs index c0f3f0e09924..46f2406a628b 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/NotificationHubPolicyKey.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PolicyKeyResource.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.NotificationHubs.Models { - /// Namespace/NotificationHub Regenerate Keys. - public partial class NotificationHubPolicyKey + /// Namespace / NotificationHub Regenerate Keys request. + public partial class PolicyKeyResource { /// /// Keeps track of any properties unknown to the library. @@ -45,21 +45,28 @@ public partial class NotificationHubPolicyKey /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public NotificationHubPolicyKey() + /// Initializes a new instance of . + /// Type of Shared Access Policy Key (primary or secondary). + public PolicyKeyResource(PolicyKeyType policyKey) { + PolicyKey = policyKey; } - /// Initializes a new instance of . - /// Name of the key that has to be regenerated for the Namespace/Notification Hub Authorization Rule. The value can be Primary Key/Secondary Key. + /// Initializes a new instance of . + /// Type of Shared Access Policy Key (primary or secondary). /// Keeps track of any properties unknown to the library. - internal NotificationHubPolicyKey(string policyKey, IDictionary serializedAdditionalRawData) + internal PolicyKeyResource(PolicyKeyType policyKey, IDictionary serializedAdditionalRawData) { PolicyKey = policyKey; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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; } + /// Initializes a new instance of for deserialization. + internal PolicyKeyResource() + { + } + + /// 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..4460f3033eba --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class PrivateEndpointConnectionProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support '{format}' format."); + } + + 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 (options.Format != "W" && Optional.IsCollectionDefined(GroupIds)) + { + writer.WritePropertyName("groupIds"u8); + writer.WriteStartArray(); + foreach (var item in GroupIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + writer.WriteObjectValue(ConnectionState); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PrivateEndpointConnectionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); + } + + internal static PrivateEndpointConnectionProperties DeserializePrivateEndpointConnectionProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NotificationHubsPrivateEndpointConnectionProvisioningState? provisioningState = default; + SubResource privateEndpoint = default; + IReadOnlyList groupIds = default; + RemotePrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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, options); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new PrivateEndpointConnectionProperties(provisioningState, privateEndpoint, groupIds ?? new ChangeTrackingList(), privateLinkServiceConnectionState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support '{options.Format}' format."); + } + } + + PrivateEndpointConnectionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..1562bce6afdb --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -0,0 +1,87 @@ +// 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; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Private Endpoint Connection properties. + public partial class PrivateEndpointConnectionProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PrivateEndpointConnectionProperties() + { + GroupIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// 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. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpointConnectionProperties(NotificationHubsPrivateEndpointConnectionProvisioningState? provisioningState, SubResource privateEndpoint, IReadOnlyList groupIds, RemotePrivateLinkServiceConnectionState connectionState, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + PrivateEndpoint = privateEndpoint; + GroupIds = groupIds; + ConnectionState = connectionState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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/PrivateEndpointConnectionResourceListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.Serialization.cs new file mode 100644 index 000000000000..08336b46ff13 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class PrivateEndpointConnectionResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionResourceListResult)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PrivateEndpointConnectionResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionResourceListResult)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrivateEndpointConnectionResourceListResult(document.RootElement, options); + } + + internal static PrivateEndpointConnectionResourceListResult DeserializePrivateEndpointConnectionResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PrivateEndpointConnectionResourceData.DeserializePrivateEndpointConnectionResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new PrivateEndpointConnectionResourceListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionResourceListResult)} does not support '{options.Format}' format."); + } + } + + PrivateEndpointConnectionResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePrivateEndpointConnectionResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionResourceListResult)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..8aa134b70994 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PrivateEndpointConnectionResourceListResult.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// The response of the List Private Endpoint Connections operation. + internal partial class PrivateEndpointConnectionResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal PrivateEndpointConnectionResourceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Gets or sets result of the List AuthorizationRules operation. + /// Gets or sets link to the next set of results. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpointConnectionResourceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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..6b1c88cd5c63 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class PublicInternetAuthorizationRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicInternetAuthorizationRule)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("rights"u8); + writer.WriteStartArray(); + foreach (var item in Rights) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PublicInternetAuthorizationRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicInternetAuthorizationRule)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePublicInternetAuthorizationRule(document.RootElement, options); + } + + internal static PublicInternetAuthorizationRule DeserializePublicInternetAuthorizationRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList rights = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new PublicInternetAuthorizationRule(rights, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PublicInternetAuthorizationRule)} does not support '{options.Format}' format."); + } + } + + PublicInternetAuthorizationRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePublicInternetAuthorizationRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PublicInternetAuthorizationRule)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..0434e42d7881 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/PublicInternetAuthorizationRule.cs @@ -0,0 +1,77 @@ +// 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.ResourceManager.NotificationHubs; + +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 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of access rights. + /// is null. + public PublicInternetAuthorizationRule(IEnumerable rights) + { + Argument.AssertNotNull(rights, nameof(rights)); + + Rights = rights.ToList(); + } + + /// Initializes a new instance of . + /// List of access rights. + /// Keeps track of any properties unknown to the library. + internal PublicInternetAuthorizationRule(IList rights, IDictionary serializedAdditionalRawData) + { + Rights = rights; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PublicInternetAuthorizationRule() + { + } + + /// 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..5f861d8d4d98 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class RegistrationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegistrationResult)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ApplicationPlatform)) + { + writer.WritePropertyName("applicationPlatform"u8); + writer.WriteStringValue(ApplicationPlatform); + } + if (options.Format != "W" && Optional.IsDefined(PnsHandle)) + { + writer.WritePropertyName("pnsHandle"u8); + writer.WriteStringValue(PnsHandle); + } + if (options.Format != "W" && Optional.IsDefined(RegistrationId)) + { + writer.WritePropertyName("registrationId"u8); + writer.WriteStringValue(RegistrationId); + } + if (options.Format != "W" && Optional.IsDefined(Outcome)) + { + writer.WritePropertyName("outcome"u8); + writer.WriteStringValue(Outcome); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RegistrationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegistrationResult)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRegistrationResult(document.RootElement, options); + } + + internal static RegistrationResult DeserializeRegistrationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string applicationPlatform = default; + string pnsHandle = default; + string registrationId = default; + string outcome = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new RegistrationResult(applicationPlatform, pnsHandle, registrationId, outcome, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RegistrationResult)} does not support '{options.Format}' format."); + } + } + + RegistrationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRegistrationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RegistrationResult)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..0d51841b9972 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RegistrationResult.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Notification result for a single registration. + public partial class RegistrationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RegistrationResult() + { + } + + /// Initializes a new instance of . + /// PNS type. + /// PNS handle. + /// Registration id. + /// Notification outcome. + /// Keeps track of any properties unknown to the library. + internal RegistrationResult(string applicationPlatform, string pnsHandle, string registrationId, string outcome, IDictionary serializedAdditionalRawData) + { + ApplicationPlatform = applicationPlatform; + PnsHandle = pnsHandle; + RegistrationId = registrationId; + Outcome = outcome; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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..40e89bbe18b6 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class RemotePrivateLinkServiceConnectionState : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RemotePrivateLinkServiceConnectionState)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && Optional.IsDefined(ActionsRequired)) + { + writer.WritePropertyName("actionsRequired"u8); + writer.WriteStringValue(ActionsRequired); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RemotePrivateLinkServiceConnectionState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RemotePrivateLinkServiceConnectionState)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRemotePrivateLinkServiceConnectionState(document.RootElement, options); + } + + internal static RemotePrivateLinkServiceConnectionState DeserializeRemotePrivateLinkServiceConnectionState(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PrivateLinkConnectionStatus? status = default; + string description = default; + string actionsRequired = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new RemotePrivateLinkServiceConnectionState(status, description, actionsRequired, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RemotePrivateLinkServiceConnectionState)} does not support '{options.Format}' format."); + } + } + + RemotePrivateLinkServiceConnectionState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRemotePrivateLinkServiceConnectionState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RemotePrivateLinkServiceConnectionState)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..c31b6db2c9c7 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/RemotePrivateLinkServiceConnectionState.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// State of the Private Link Service connection. + public partial class RemotePrivateLinkServiceConnectionState + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RemotePrivateLinkServiceConnectionState() + { + } + + /// Initializes a new instance of . + /// State of Private Link Connection. + /// Human-friendly description. + /// Human-friendly description of required actions. + /// Keeps track of any properties unknown to the library. + internal RemotePrivateLinkServiceConnectionState(PrivateLinkConnectionStatus? status, string description, string actionsRequired, IDictionary serializedAdditionalRawData) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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/SharedAccessAuthorizationRuleListResult.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.Serialization.cs index 64994095a7e2..c01143d0ea98 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.Serialization.cs @@ -27,7 +27,7 @@ void IJsonModel.Write(Utf8JsonWriter wr } writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Value)) + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -37,7 +37,7 @@ void IJsonModel.Write(Utf8JsonWriter wr } writer.WriteEndArray(); } - if (Optional.IsDefined(NextLink)) + if (options.Format != "W" && Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink); 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 48c8294359e1..93f794568d73 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/SharedAccessAuthorizationRuleListResult.cs @@ -53,8 +53,8 @@ internal SharedAccessAuthorizationRuleListResult() } /// Initializes a new instance of . - /// 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. /// Keeps track of any properties unknown to the library. internal SharedAccessAuthorizationRuleListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) { @@ -63,9 +63,9 @@ internal SharedAccessAuthorizationRuleListResult(IReadOnlyList 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 b2c25559b23e..ea6378312ec2 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 @@ -27,22 +27,19 @@ void IJsonModel.Write(Utf8JsonWriter wr } 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()); } - if (options.Format != "W" && Optional.IsDefined(PrimaryKey)) + writer.WriteEndArray(); + if (Optional.IsDefined(PrimaryKey)) { writer.WritePropertyName("primaryKey"u8); writer.WriteStringValue(PrimaryKey); } - if (options.Format != "W" && Optional.IsDefined(SecondaryKey)) + if (Optional.IsDefined(SecondaryKey)) { writer.WritePropertyName("secondaryKey"u8); writer.WriteStringValue(SecondaryKey); @@ -52,16 +49,6 @@ void IJsonModel.Write(Utf8JsonWriter wr writer.WritePropertyName("keyName"u8); writer.WriteStringValue(KeyName); } - if (options.Format != "W" && Optional.IsDefined(ClaimType)) - { - writer.WritePropertyName("claimType"u8); - writer.WriteStringValue(ClaimType); - } - if (options.Format != "W" && Optional.IsDefined(ClaimValue)) - { - writer.WritePropertyName("claimValue"u8); - writer.WriteStringValue(ClaimValue); - } if (options.Format != "W" && Optional.IsDefined(ModifiedOn)) { writer.WritePropertyName("modifiedTime"u8); @@ -72,6 +59,16 @@ void IJsonModel.Write(Utf8JsonWriter wr writer.WritePropertyName("createdTime"u8); writer.WriteStringValue(CreatedOn.Value, "O"); } + if (options.Format != "W" && Optional.IsDefined(ClaimType)) + { + writer.WritePropertyName("claimType"u8); + writer.WriteStringValue(ClaimType); + } + if (options.Format != "W" && Optional.IsDefined(ClaimValue)) + { + writer.WritePropertyName("claimValue"u8); + writer.WriteStringValue(ClaimValue); + } if (options.Format != "W" && Optional.IsDefined(Revision)) { writer.WritePropertyName("revision"u8); @@ -119,10 +116,10 @@ internal static SharedAccessAuthorizationRuleProperties DeserializeSharedAccessA string primaryKey = default; string secondaryKey = default; string keyName = default; - string claimType = default; - string claimValue = default; DateTimeOffset? modifiedTime = default; DateTimeOffset? createdTime = default; + string claimType = default; + string claimValue = default; int? revision = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); @@ -130,14 +127,10 @@ internal static SharedAccessAuthorizationRuleProperties DeserializeSharedAccessA { 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; @@ -157,16 +150,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) @@ -185,6 +168,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) @@ -201,14 +194,14 @@ internal static SharedAccessAuthorizationRuleProperties DeserializeSharedAccessA } serializedAdditionalRawData = additionalPropertiesDictionary; return new SharedAccessAuthorizationRuleProperties( - rights ?? new ChangeTrackingList(), + rights, primaryKey, secondaryKey, keyName, - claimType, - claimValue, modifiedTime, createdTime, + claimType, + claimValue, revision, serializedAdditionalRawData); } 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 18de934a51c7..e72b14c44d9a 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.ResourceManager.NotificationHubs; namespace Azure.ResourceManager.NotificationHubs.Models @@ -47,53 +48,74 @@ public partial class SharedAccessAuthorizationRuleProperties private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - 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 . - /// 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. + /// 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. /// Keeps track of any properties unknown to the library. - internal SharedAccessAuthorizationRuleProperties(IList rights, string primaryKey, string secondaryKey, string keyName, string claimType, string claimValue, DateTimeOffset? modifiedOn, DateTimeOffset? createdOn, int? revision, IDictionary serializedAdditionalRawData) + internal SharedAccessAuthorizationRuleProperties(IList rights, string primaryKey, string secondaryKey, string keyName, DateTimeOffset? modifiedOn, DateTimeOffset? createdOn, string claimType, string claimValue, int? revision, IDictionary serializedAdditionalRawData) { Rights = rights; PrimaryKey = primaryKey; SecondaryKey = secondaryKey; KeyName = keyName; - ClaimType = claimType; - ClaimValue = claimValue; ModifiedOn = modifiedOn; CreatedOn = createdOn; + ClaimType = claimType; + ClaimValue = claimValue; Revision = revision; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The rights associated with the rule. + /// Initializes a new instance of for deserialization. + internal SharedAccessAuthorizationRuleProperties() + { + } + + /// 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..c5ce949e0b9d --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class WnsCredentialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WnsCredentialProperties)} does not support '{format}' format."); + } + + 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); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + WnsCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WnsCredentialProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWnsCredentialProperties(document.RootElement, options); + } + + internal static WnsCredentialProperties DeserializeWnsCredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string packageSid = default; + string secretKey = default; + string windowsLiveEndpoint = default; + string certificateKey = default; + string wnsCertificate = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new WnsCredentialProperties( + packageSid, + secretKey, + windowsLiveEndpoint, + certificateKey, + wnsCertificate, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WnsCredentialProperties)} does not support '{options.Format}' format."); + } + } + + WnsCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWnsCredentialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WnsCredentialProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..124af97d0c3c --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/WnsCredentialProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub WnsCredential. + public partial class WnsCredentialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public WnsCredentialProperties() + { + } + + /// Initializes a new instance of . + /// 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. + /// Keeps track of any properties unknown to the library. + internal WnsCredentialProperties(string packageSid, string secretKey, string windowsLiveEndpoint, string certificateKey, string wnsCertificate, IDictionary serializedAdditionalRawData) + { + PackageSid = packageSid; + SecretKey = secretKey; + WindowsLiveEndpoint = windowsLiveEndpoint; + CertificateKey = certificateKey; + WnsCertificate = wnsCertificate; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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..45d9ee4399f0 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.Serialization.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + internal partial class XiaomiCredential : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XiaomiCredential)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + XiaomiCredential IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XiaomiCredential)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeXiaomiCredential(document.RootElement, options); + } + + internal static XiaomiCredential DeserializeXiaomiCredential(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + XiaomiCredentialProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = XiaomiCredentialProperties.DeserializeXiaomiCredentialProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new XiaomiCredential(properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(XiaomiCredential)} does not support '{options.Format}' format."); + } + } + + XiaomiCredential IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeXiaomiCredential(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(XiaomiCredential)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..8e321ca2f2ba --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredential.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub XiaomiCredential. + internal partial class XiaomiCredential + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Description of a NotificationHub XiaomiCredentialProperties. + /// is null. + public XiaomiCredential(XiaomiCredentialProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of . + /// Description of a NotificationHub XiaomiCredentialProperties. + /// Keeps track of any properties unknown to the library. + internal XiaomiCredential(XiaomiCredentialProperties properties, IDictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal XiaomiCredential() + { + } + + /// 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..866ec08ebec4 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + public partial class XiaomiCredentialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XiaomiCredentialProperties)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(AppSecret)) + { + writer.WritePropertyName("appSecret"u8); + writer.WriteStringValue(AppSecret); + } + if (Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + XiaomiCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XiaomiCredentialProperties)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeXiaomiCredentialProperties(document.RootElement, options); + } + + internal static XiaomiCredentialProperties DeserializeXiaomiCredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string appSecret = default; + string endpoint = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new XiaomiCredentialProperties(appSecret, endpoint, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(XiaomiCredentialProperties)} does not support '{options.Format}' format."); + } + } + + XiaomiCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeXiaomiCredentialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(XiaomiCredentialProperties)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..7d1c267e8cab --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Models/XiaomiCredentialProperties.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NotificationHubs.Models +{ + /// Description of a NotificationHub XiaomiCredentialProperties. + public partial class XiaomiCredentialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public XiaomiCredentialProperties() + { + } + + /// Initializes a new instance of . + /// Gets or sets app secret. + /// Gets or sets xiaomi service endpoint. + /// Keeps track of any properties unknown to the library. + internal XiaomiCredentialProperties(string appSecret, string endpoint, IDictionary serializedAdditionalRawData) + { + AppSecret = appSecret; + Endpoint = endpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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 55% rename from sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleCollection.cs rename to sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceAuthorizationRuleCollection.cs index 3f38941ab873..7434448f6bc3 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 @@ -67,31 +66,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// /// 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; @@ -108,7 +107,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 @@ -116,31 +115,31 @@ public virtual async Task /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// /// 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; @@ -157,7 +156,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 @@ -165,30 +164,30 @@ public virtual ArmOperation C /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// 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) { @@ -202,7 +201,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 @@ -210,30 +209,30 @@ public virtual async Task /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// 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) { @@ -247,7 +246,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 @@ -255,21 +254,21 @@ public virtual Response Get(s /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// /// 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); } /// @@ -277,7 +276,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 @@ -285,21 +284,21 @@ public virtual AsyncPageable /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// /// 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); } /// @@ -307,7 +306,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 @@ -315,15 +314,15 @@ public virtual Pageable GetAl /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -331,11 +330,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) @@ -350,7 +349,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 @@ -358,15 +357,15 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -374,11 +373,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) @@ -393,7 +392,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 @@ -401,30 +400,30 @@ public virtual Response Exists(string authorizationRuleName, CancellationT /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// 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) { @@ -438,7 +437,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 @@ -446,30 +445,30 @@ public virtual async Task /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// 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) { @@ -478,7 +477,7 @@ public virtual NullableResponse IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -488,7 +487,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..f1a9c88d14dd --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceAuthorizationRuleResource.cs @@ -0,0 +1,847 @@ +// 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. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The authorizationRuleName. + 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; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/authorizationRules"; + + /// 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 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 fc1330ec0ae5..59d9b600d49f 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 @@ -67,31 +66,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// /// 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; @@ -108,7 +107,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 @@ -116,31 +115,31 @@ public virtual async Task /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// /// 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; @@ -157,7 +156,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 @@ -165,30 +164,30 @@ public virtual ArmOperation CreateOrUp /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// 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) { @@ -202,7 +201,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 @@ -210,30 +209,30 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// 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) { @@ -247,7 +246,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 @@ -255,21 +254,21 @@ public virtual Response Get(string aut /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// /// 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); } /// @@ -277,7 +276,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 @@ -285,21 +284,21 @@ public virtual AsyncPageable GetAllAsy /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// /// 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); } /// @@ -307,7 +306,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 @@ -315,15 +314,15 @@ public virtual Pageable GetAll(Cancell /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -331,11 +330,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) @@ -350,7 +349,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 @@ -358,15 +357,15 @@ public virtual async Task> ExistsAsync(string authorizationRuleNa /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -374,11 +373,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) @@ -393,7 +392,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 @@ -401,30 +400,30 @@ public virtual Response Exists(string authorizationRuleName, CancellationT /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// 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) { @@ -438,7 +437,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 @@ -446,30 +445,30 @@ public virtual async Task /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// 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) { @@ -478,7 +477,7 @@ public virtual NullableResponse GetIfE } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -488,7 +487,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..55c95c5dd117 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NamespaceNotificationHubAuthorizationRuleResource.cs @@ -0,0 +1,848 @@ +// 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. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The notificationHubName. + /// The authorizationRuleName. + 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; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/notificationHubs/authorizationRules"; + + /// 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 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.Serialization.cs index e795f853aac9..f000fb3248c0 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.Serialization.cs @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter write } 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)) { @@ -66,59 +66,6 @@ void IJsonModel.Write(Utf8JsonWriter write writer.WritePropertyName("systemData"u8); JsonSerializer.Serialize(writer, SystemData); } - 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(); - } - if (options.Format != "W" && Optional.IsDefined(PrimaryKey)) - { - writer.WritePropertyName("primaryKey"u8); - writer.WriteStringValue(PrimaryKey); - } - if (options.Format != "W" && Optional.IsDefined(SecondaryKey)) - { - writer.WritePropertyName("secondaryKey"u8); - writer.WriteStringValue(SecondaryKey); - } - if (options.Format != "W" && Optional.IsDefined(KeyName)) - { - writer.WritePropertyName("keyName"u8); - writer.WriteStringValue(KeyName); - } - if (options.Format != "W" && Optional.IsDefined(ClaimType)) - { - writer.WritePropertyName("claimType"u8); - writer.WriteStringValue(ClaimType); - } - if (options.Format != "W" && Optional.IsDefined(ClaimValue)) - { - writer.WritePropertyName("claimValue"u8); - writer.WriteStringValue(ClaimValue); - } - if (options.Format != "W" && Optional.IsDefined(ModifiedOn)) - { - writer.WritePropertyName("modifiedTime"u8); - writer.WriteStringValue(ModifiedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdTime"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(Revision)) - { - writer.WritePropertyName("revision"u8); - writer.WriteNumberValue(Revision.Value); - } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -157,33 +104,24 @@ internal static NotificationHubAuthorizationRuleData DeserializeNotificationHubA { return null; } - NotificationHubSku sku = default; + SharedAccessAuthorizationRuleProperties properties = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - IList rights = default; - string primaryKey = default; - string secondaryKey = default; - string keyName = default; - string claimType = default; - string claimValue = default; - DateTimeOffset? modifiedTime = default; - DateTimeOffset? createdTime = default; - int? revision = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); 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, options); + properties = SharedAccessAuthorizationRuleProperties.DeserializeSharedAccessAuthorizationRuleProperties(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -229,84 +167,6 @@ 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; - } if (options.Format != "W") { additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -320,16 +180,7 @@ internal static NotificationHubAuthorizationRuleData DeserializeNotificationHubA systemData, tags ?? new ChangeTrackingDictionary(), location, - rights ?? new ChangeTrackingList(), - primaryKey, - secondaryKey, - keyName, - claimType, - claimValue, - modifiedTime, - createdTime, - revision, - sku, + properties, serializedAdditionalRawData); } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.cs index 85c2de67e07e..6f572797f4a0 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleData.cs @@ -15,7 +15,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 { @@ -55,7 +55,6 @@ public partial class NotificationHubAuthorizationRuleData : TrackedResourceData /// The location. public NotificationHubAuthorizationRuleData(AzureLocation location) : base(location) { - Rights = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -65,29 +64,11 @@ 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. + /// SharedAccessAuthorizationRule properties. /// Keeps track of any properties unknown to the library. - 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, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal NotificationHubAuthorizationRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SharedAccessAuthorizationRuleProperties properties, IDictionary serializedAdditionalRawData) : 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; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -96,25 +77,7 @@ internal NotificationHubAuthorizationRuleData() { } - /// 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 848d75a200bd..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleResource.cs +++ /dev/null @@ -1,511 +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. - /// The subscriptionId. - /// The resourceGroupName. - /// The namespaceName. - /// The notificationHubName. - /// The authorizationRuleName. - 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; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/notificationHubs/AuthorizationRules"; - - /// 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 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 b40a49ea4835..868e6cd67ffe 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 { @@ -67,7 +66,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -76,21 +75,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); @@ -116,7 +115,7 @@ public virtual async Task> CreateOrUpdateA /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -125,21 +124,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); @@ -153,7 +152,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa } /// - /// Lists the notification hubs associated with a namespace. + /// Gets the notification hub. /// /// /// Request Path @@ -165,7 +164,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -173,7 +172,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. @@ -198,7 +197,7 @@ public virtual async Task> GetAsync(string not } /// - /// Lists the notification hubs associated with a namespace. + /// Gets the notification hub. /// /// /// Request Path @@ -210,7 +209,7 @@ public virtual async Task> GetAsync(string not /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -218,7 +217,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. @@ -255,7 +254,7 @@ public virtual Response Get(string notificationHubName, /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -263,12 +262,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); } @@ -285,7 +286,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -293,12 +294,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); } @@ -315,7 +318,7 @@ public virtual Pageable GetAll(CancellationToken cancel /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -323,7 +326,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. @@ -358,7 +361,7 @@ public virtual async Task> ExistsAsync(string notificationHubName /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -366,7 +369,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. @@ -401,7 +404,7 @@ public virtual Response Exists(string notificationHubName, CancellationTok /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -409,7 +412,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. @@ -446,7 +449,7 @@ public virtual async Task> GetIfExists /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -454,7 +457,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.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.Serialization.cs index 9f5a5f23fb15..d9c233973c76 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.Serialization.cs @@ -28,6 +28,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri } writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -66,59 +71,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("systemData"u8); JsonSerializer.Serialize(writer, SystemData); } - 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(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -157,6 +109,7 @@ internal static NotificationHubData DeserializeNotificationHubData(JsonElement e { return null; } + NotificationHubProperties properties = default; NotificationHubSku sku = default; IDictionary tags = default; AzureLocation location = default; @@ -164,19 +117,19 @@ internal static NotificationHubData DeserializeNotificationHubData(JsonElement e string name = default; ResourceType type = default; SystemData systemData = default; - string name0 = default; - TimeSpan? registrationTtl = default; - IList authorizationRules = default; - NotificationHubApnsCredential apnsCredential = default; - NotificationHubWnsCredential wnsCredential = default; - NotificationHubGcmCredential gcmCredential = default; - NotificationHubMpnsCredential mpnsCredential = default; - NotificationHubAdmCredential admCredential = default; - NotificationHubBaiduCredential baiduCredential = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NotificationHubProperties.DeserializeNotificationHubProperties(property.Value, options); + continue; + } if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -229,100 +182,6 @@ 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, options)); - } - authorizationRules = array; - continue; - } - if (property0.NameEquals("apnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - apnsCredential = NotificationHubApnsCredential.DeserializeNotificationHubApnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("wnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - wnsCredential = NotificationHubWnsCredential.DeserializeNotificationHubWnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("gcmCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gcmCredential = NotificationHubGcmCredential.DeserializeNotificationHubGcmCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("mpnsCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mpnsCredential = NotificationHubMpnsCredential.DeserializeNotificationHubMpnsCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("admCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - admCredential = NotificationHubAdmCredential.DeserializeNotificationHubAdmCredential(property0.Value, options); - continue; - } - if (property0.NameEquals("baiduCredential"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - baiduCredential = NotificationHubBaiduCredential.DeserializeNotificationHubBaiduCredential(property0.Value, options); - continue; - } - } - continue; - } if (options.Format != "W") { additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -336,15 +195,7 @@ internal static NotificationHubData DeserializeNotificationHubData(JsonElement e systemData, tags ?? new ChangeTrackingDictionary(), location, - name0, - registrationTtl, - authorizationRules ?? new ChangeTrackingList(), - apnsCredential, - wnsCredential, - gcmCredential, - mpnsCredential, - admCredential, - baiduCredential, + properties, sku, serializedAdditionalRawData); } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.cs index 03559873144b..55792f6b44f8 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubData.cs @@ -15,7 +15,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 { @@ -55,7 +55,6 @@ public partial class NotificationHubData : TrackedResourceData /// The location. public NotificationHubData(AzureLocation location) : base(location) { - AuthorizationRules = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -65,28 +64,12 @@ 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. + /// NotificationHub properties. + /// The Sku description for a namespace. /// Keeps track of any properties unknown to the library. - 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, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal NotificationHubData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NotificationHubProperties properties, NotificationHubSku sku, IDictionary serializedAdditionalRawData) : 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; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -96,25 +79,9 @@ internal NotificationHubData() { } - /// 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 08c768849310..000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleResource.cs +++ /dev/null @@ -1,510 +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. - /// The subscriptionId. - /// The resourceGroupName. - /// The namespaceName. - /// The authorizationRuleName. - 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; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/AuthorizationRules"; - - /// 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 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 - /// - /// - /// Default Api Version - /// 2017-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// 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 2608dce033ba..bac205e529dc 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 @@ -68,7 +67,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -77,22 +76,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; @@ -105,7 +104,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 @@ -117,7 +116,7 @@ public virtual async Task> Create /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -126,22 +125,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; @@ -154,7 +153,7 @@ public virtual ArmOperation CreateOrUpdate(Wai } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -166,7 +165,7 @@ public virtual ArmOperation CreateOrUpdate(Wai /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -174,7 +173,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. @@ -199,7 +198,7 @@ public virtual async Task> GetAsync(s } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -211,7 +210,7 @@ public virtual async Task> GetAsync(s /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -219,7 +218,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. @@ -244,7 +243,7 @@ public virtual Response Get(string namespaceNa } /// - /// Lists the available namespaces within a resourceGroup. + /// Lists the available namespaces within a resource group. /// /// /// Request Path @@ -256,7 +255,7 @@ public virtual Response Get(string namespaceNa /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -264,17 +263,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 @@ -286,7 +287,7 @@ public virtual AsyncPageable GetAllAsync(Cance /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -294,12 +295,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); } @@ -316,7 +319,7 @@ public virtual Pageable GetAll(CancellationTok /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -324,7 +327,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. @@ -359,7 +362,7 @@ public virtual async Task> ExistsAsync(string namespaceName, Canc /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -367,7 +370,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. @@ -402,7 +405,7 @@ public virtual Response Exists(string namespaceName, CancellationToken can /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -410,7 +413,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. @@ -447,7 +450,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -455,7 +458,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.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.Serialization.cs index e829e188a9fc..88291dae74f7 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.Serialization.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.Serialization.cs @@ -28,10 +28,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model } 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)) { @@ -66,79 +68,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model writer.WritePropertyName("systemData"u8); JsonSerializer.Serialize(writer, SystemData); } - 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 (options.Format != "W" && Optional.IsDefined(MetricId)) - { - writer.WritePropertyName("metricId"u8); - writer.WriteStringValue(MetricId); - } - 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(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -178,37 +107,29 @@ internal static NotificationHubNamespaceData DeserializeNotificationHubNamespace return null; } NotificationHubSku sku = default; + NamespaceProperties properties = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - string name0 = default; - string provisioningState = default; - string region = default; - string metricId = default; - string status = default; - DateTimeOffset? createdAt = default; - DateTimeOffset? updatedAt = default; - Uri serviceBusEndpoint = default; - string subscriptionId = default; - string scaleUnit = default; - bool? enabled = default; - bool? critical = default; - string dataCenter = default; - NotificationHubNamespaceType? namespaceType = default; IDictionary serializedAdditionalRawData = default; Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) + { + sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); + continue; + } + if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = NotificationHubSku.DeserializeNotificationHubSku(property.Value, options); + properties = NamespaceProperties.DeserializeNamespaceProperties(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -254,112 +175,6 @@ 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; - } if (options.Format != "W") { additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -373,21 +188,8 @@ internal static NotificationHubNamespaceData DeserializeNotificationHubNamespace systemData, tags ?? new ChangeTrackingDictionary(), location, - name0, - provisioningState, - region, - metricId, - status, - createdAt, - updatedAt, - serviceBusEndpoint, - subscriptionId, - scaleUnit, - enabled, - critical, - dataCenter, - namespaceType, sku, + properties, serializedAdditionalRawData); } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.cs index 571bd0e7f2fe..37bfc671d762 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceData.cs @@ -15,7 +15,7 @@ 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 { @@ -53,8 +53,13 @@ public partial class NotificationHubNamespaceData : TrackedResourceData /// Initializes a new instance of . /// 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 . @@ -64,39 +69,13 @@ 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. + /// The Sku description for a namespace. + /// Represents namespace properties. /// Keeps track of any properties unknown to the library. - 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, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal NotificationHubNamespaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NotificationHubSku sku, NamespaceProperties properties, IDictionary serializedAdditionalRawData) : 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; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -105,35 +84,9 @@ internal NotificationHubNamespaceData() { } - /// 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 fee938a0d460..b705dbd7504d 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs @@ -96,11 +96,80 @@ 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 NotificationHubCollection(client, Id)); + } + + /// + /// Gets the notification hub. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName} + /// + /// + /// Operation Id + /// NotificationHubs_Get + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Notification Hub name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Notification Hub name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNotificationHub(string notificationHubName, CancellationToken cancellationToken = default) { - return GetCachedClient(client => new NotificationHubNamespaceAuthorizationRuleCollection(client, Id)); + 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)); } /// @@ -108,7 +177,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 @@ -116,22 +185,22 @@ public virtual NotificationHubNamespaceAuthorizationRuleCollection GetNotificati /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetNotificationHubNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual async Task> GetNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { - return await GetNotificationHubNamespaceAuthorizationRules().GetAsync(authorizationRuleName, cancellationToken).ConfigureAwait(false); + return await GetNamespaceAuthorizationRules().GetAsync(authorizationRuleName, cancellationToken).ConfigureAwait(false); } /// @@ -139,7 +208,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 @@ -147,95 +216,168 @@ public virtual async Task /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetNotificationHubNamespaceAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) + public virtual Response 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 /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The notification hub name. + /// Private Endpoint Connection Name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> 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 /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The notification hub name. + /// Private Endpoint Connection Name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNotificationHubsPrivateLinkResource(string subResourceName, CancellationToken cancellationToken = default) + { + return GetNotificationHubsPrivateLinkResources().Get(subResourceName, cancellationToken); + } + + /// + /// Returns the given namespace. /// /// /// Request Path @@ -247,7 +389,7 @@ public virtual Response GetNotificationHub(string notif /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -275,7 +417,7 @@ public virtual async Task> GetAsync(C } /// - /// Returns the description for the specified namespace. + /// Returns the given namespace. /// /// /// Request Path @@ -287,7 +429,7 @@ public virtual async Task> GetAsync(C /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -327,7 +469,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -344,7 +486,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; @@ -369,7 +511,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -386,7 +528,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; @@ -399,7 +541,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Patches the existing namespace + /// Patches the existing namespace. /// /// /// Request Path @@ -407,11 +549,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Namespaces_Patch + /// Namespaces_Update /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -419,7 +561,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// 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) @@ -430,7 +572,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) @@ -441,7 +583,7 @@ public virtual async Task> UpdateAsyn } /// - /// Patches the existing namespace + /// Patches the existing namespace. /// /// /// Request Path @@ -449,11 +591,11 @@ public virtual async Task> UpdateAsyn /// /// /// Operation Id - /// Namespaces_Patch + /// Namespaces_Update /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -461,7 +603,7 @@ public virtual async Task> UpdateAsyn /// /// /// - /// 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) @@ -472,7 +614,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) @@ -495,11 +637,11 @@ public virtual Response Update(NotificationHub /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// - /// The notificationHub name. + /// Request content. /// The cancellation token to use. /// is null. public virtual async Task> CheckNotificationHubAvailabilityAsync(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -533,11 +675,11 @@ public virtual async Task> CheckNoti /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// - /// The notificationHub name. + /// Request content. /// The cancellation token to use. /// is null. public virtual Response CheckNotificationHubAvailability(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) @@ -558,6 +700,82 @@ 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. /// @@ -571,7 +789,7 @@ public virtual Response CheckNotificationHubA /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -633,7 +851,7 @@ public virtual async Task> AddTagAsyn /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -695,7 +913,7 @@ public virtual Response AddTag(string key, str /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -752,7 +970,7 @@ public virtual async Task> SetTagsAsy /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -809,7 +1027,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -869,7 +1087,7 @@ public virtual async Task> RemoveTagA /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs index ad71602ad168..93c5b24ab05a 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs @@ -92,11 +92,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)); } /// @@ -104,7 +104,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 @@ -112,22 +112,22 @@ public virtual NotificationHubAuthorizationRuleCollection GetNotificationHubAuth /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. [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); } /// @@ -135,7 +135,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 @@ -143,26 +143,26 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource - /// + /// /// /// /// - /// authorization rule name. + /// Authorization Rule Name. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. [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 Response GetNotificatio /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -202,7 +202,7 @@ public virtual async Task> GetAsync(Cancellati } /// - /// Lists the notification hubs associated with a namespace. + /// Gets the notification hub. /// /// /// Request Path @@ -214,7 +214,7 @@ public virtual async Task> GetAsync(Cancellati /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -254,7 +254,7 @@ public virtual Response Get(CancellationToken cancellat /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -296,7 +296,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -334,11 +334,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// NotificationHubs_Patch + /// NotificationHubs_Update /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -346,7 +346,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// 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) @@ -357,7 +357,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) @@ -376,11 +376,11 @@ public virtual async Task> UpdateAsync(Notific /// /// /// Operation Id - /// NotificationHubs_Patch + /// NotificationHubs_Update /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -388,7 +388,7 @@ public virtual async Task> UpdateAsync(Notific /// /// /// - /// 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) @@ -399,7 +399,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) @@ -410,7 +410,7 @@ public virtual Response Update(NotificationHubPatch pat } /// - /// test send a push notification + /// Test send a push notification. /// /// /// Request Path @@ -422,7 +422,7 @@ public virtual Response Update(NotificationHubPatch pat /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -430,15 +430,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) @@ -449,7 +448,7 @@ public virtual async Task> DebugSendAsyn } /// - /// test send a push notification + /// Test send a push notification. /// /// /// Request Path @@ -461,7 +460,7 @@ public virtual async Task> DebugSendAsyn /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -469,15 +468,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) @@ -488,7 +486,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 @@ -500,7 +498,7 @@ public virtual Response DebugSend(BinaryData anyO /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -526,7 +524,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 @@ -538,7 +536,7 @@ public virtual async Task> GetPnsCredent /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -576,7 +574,7 @@ public virtual Response GetPnsCredentials(Cancell /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -608,7 +606,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); @@ -638,7 +636,7 @@ public virtual async Task> AddTagAsync(string /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -670,7 +668,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); @@ -700,7 +698,7 @@ public virtual Response AddTag(string key, string value /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -731,7 +729,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; @@ -757,7 +755,7 @@ public virtual async Task> SetTagsAsync(IDicti /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -788,7 +786,7 @@ public virtual Response SetTags(IDictionary SetTags(IDictionary /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -844,7 +842,7 @@ public virtual async Task> 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); @@ -874,7 +872,7 @@ public virtual async Task> RemoveTagAsync(stri /// /// /// Default Api Version - /// 2017-04-01 + /// 2023-10-01-preview /// /// /// Resource @@ -904,7 +902,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..cc4be77e5a09 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResource.cs @@ -0,0 +1,175 @@ +// 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. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The subResourceName. + 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; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/privateLinkResources"; + + /// 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 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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..a7b95bd88a8e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceCollection.cs @@ -0,0 +1,399 @@ +// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceData.Serialization.cs new file mode 100644 index 000000000000..e4d1534dc5eb --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceData.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs +{ + public partial class NotificationHubsPrivateLinkResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceData)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + NotificationHubsPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceData)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNotificationHubsPrivateLinkResourceData(document.RootElement, options); + } + + internal static NotificationHubsPrivateLinkResourceData DeserializeNotificationHubsPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NotificationHubsPrivateLinkResourceProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NotificationHubsPrivateLinkResourceProperties.DeserializeNotificationHubsPrivateLinkResourceProperties(property.Value, options); + 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 (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new NotificationHubsPrivateLinkResourceData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceData)} does not support '{options.Format}' format."); + } + } + + NotificationHubsPrivateLinkResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNotificationHubsPrivateLinkResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NotificationHubsPrivateLinkResourceData)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..2f3c2d60e36e --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubsPrivateLinkResourceData.cs @@ -0,0 +1,75 @@ +// 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; +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 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NotificationHubsPrivateLinkResourceData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Represents properties of Private Link Resource. + /// Keeps track of any properties unknown to the library. + internal NotificationHubsPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, NotificationHubsPrivateLinkResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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..2e6171a93809 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResource.cs @@ -0,0 +1,355 @@ +// 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. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The privateEndpointConnectionName. + 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; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NotificationHubs/namespaces/privateEndpointConnections"; + + /// 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 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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..c027e24eec31 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceCollection.cs @@ -0,0 +1,499 @@ +// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2023-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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.Serialization.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceData.Serialization.cs new file mode 100644 index 000000000000..877cbc1e01a6 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceData.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs +{ + public partial class PrivateEndpointConnectionResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionResourceData)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PrivateEndpointConnectionResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionResourceData)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrivateEndpointConnectionResourceData(document.RootElement, options); + } + + internal static PrivateEndpointConnectionResourceData DeserializePrivateEndpointConnectionResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PrivateEndpointConnectionProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PrivateEndpointConnectionProperties.DeserializePrivateEndpointConnectionProperties(property.Value, options); + 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 (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new PrivateEndpointConnectionResourceData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionResourceData)} does not support '{options.Format}' format."); + } + } + + PrivateEndpointConnectionResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePrivateEndpointConnectionResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionResourceData)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..18ffaf296485 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/PrivateEndpointConnectionResourceData.cs @@ -0,0 +1,75 @@ +// 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; +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 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PrivateEndpointConnectionResourceData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Private Endpoint Connection properties. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpointConnectionResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateEndpointConnectionProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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 887a60ea1d7d..534583a48b9d 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: