diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/CHANGELOG.md b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/CHANGELOG.md index 5d48ed5516b8..3552d5a0eca4 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/CHANGELOG.md +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/CHANGELOG.md @@ -1,14 +1,363 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0-beta.1 (2025-05-09) -### Features Added +- Azure Resource Manager Notificationhubs client library for Java. This package contains Microsoft Azure SDK for Notificationhubs Management SDK. Microsoft Notification Hubs Resource Provider REST API. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.SharedAccessAuthorizationRuleListResult` was removed -### Other Changes +#### `models.NamespaceCreateOrUpdateParameters` was removed + +#### `models.NotificationHubListResult` was removed + +#### `models.PolicykeyResource` was removed + +#### `NotificationHubsManager` was removed + +#### `models.NotificationHubs` was removed + +#### `models.NamespaceListResult` was removed + +#### `NotificationHubsManager$Configurable` was removed + +#### `models.OperationListResult` was removed + +#### `models.SharedAccessAuthorizationRuleCreateOrUpdateParameters` was removed + +#### `models.NotificationHubCreateOrUpdateParameters` was removed + +#### `models.NamespaceResource$DefinitionStages` was modified + +* Required stage 3 was added +* `withLocation(com.azure.core.management.Region)` was removed in stage 1 +* `withLocation(java.lang.String)` was removed in stage 1 + +#### `models.SharedAccessAuthorizationRuleResource$DefinitionStages` was modified + +* `withExistingNamespace(java.lang.String,java.lang.String)` was removed in stage 1 + +#### `models.SharedAccessAuthorizationRuleResource$Definition` was modified + +* `withProperties(fluent.models.SharedAccessAuthorizationRuleProperties)` was removed +* `withExistingNamespace(java.lang.String,java.lang.String)` was removed + +#### `models.NotificationHubResource` was modified + +* `debugSendWithResponse(java.lang.Object,com.azure.core.util.Context)` was removed + +#### `models.DebugSendResponse` was modified + +* `java.lang.Float success()` -> `java.lang.Long success()` +* `java.lang.Object results()` -> `java.util.List results()` +* `sku()` was removed +* `java.lang.Float failure()` -> `java.lang.Long failure()` + +#### `models.PnsCredentialsResource` was modified + +* `sku()` was removed + +#### `models.NotificationHubResource$Update` was modified + +* `withAuthorizationRules(java.util.List)` was removed +* `withNamePropertiesName(java.lang.String)` was removed + +#### `models.SharedAccessAuthorizationRuleResource$Update` was modified + +* `withProperties(fluent.models.SharedAccessAuthorizationRuleProperties)` was removed + +#### `models.Namespaces` was modified + +* `checkAvailability(models.CheckAvailabilityParameters)` was removed +* `getByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was removed +* `deleteAuthorizationRuleById(java.lang.String)` was removed +* `delete(java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `deleteById(java.lang.String)` was removed +* `list(com.azure.core.util.Context)` was removed +* `define(java.lang.String)` was removed +* `deleteByResourceGroup(java.lang.String,java.lang.String)` was removed +* `getByResourceGroup(java.lang.String,java.lang.String)` was removed +* `listByResourceGroup(java.lang.String)` was removed +* `listByResourceGroup(java.lang.String,com.azure.core.util.Context)` was removed +* `getAuthorizationRuleByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was removed +* `defineAuthorizationRule(java.lang.String)` was removed +* `deleteAuthorizationRuleByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was removed +* `getAuthorizationRuleById(java.lang.String)` was removed +* `getByResourceGroupWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `regenerateKeys(java.lang.String,java.lang.String,java.lang.String,models.PolicykeyResource)` was removed +* `checkAvailabilityWithResponse(models.CheckAvailabilityParameters,com.azure.core.util.Context)` was removed +* `getById(java.lang.String)` was removed +* `list()` was removed +* `regenerateKeysWithResponse(java.lang.String,java.lang.String,java.lang.String,models.PolicykeyResource,com.azure.core.util.Context)` was removed +* `deleteByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was removed + +#### `models.AccessRights` was modified + +* `models.AccessRights[] values()` -> `java.util.Collection values()` +* `toString()` was removed +* `valueOf(java.lang.String)` was removed + +#### `models.NotificationHubPatchParameters` was modified + +* `namePropertiesName()` was removed +* `withAuthorizationRules(java.util.List)` was removed +* `withLocation(java.lang.String)` was removed +* `id()` was removed +* `type()` was removed +* `withTags(java.util.Map)` was removed +* `withNamePropertiesName(java.lang.String)` was removed + +#### `models.NotificationHubResource$Definition` was modified + +* `withAuthorizationRules(java.util.List)` was removed + +#### `models.NamespaceType` was modified + +* `valueOf(java.lang.String)` was removed +* `models.NamespaceType[] values()` -> `java.util.Collection values()` +* `toString()` was removed + +#### `models.SharedAccessAuthorizationRuleResource` was modified + +* `sku()` was removed +* `regenerateKeysWithResponse(models.PolicykeyResource,com.azure.core.util.Context)` was removed +* `java.lang.String modifiedTime()` -> `java.time.OffsetDateTime modifiedTime()` +* `java.lang.String createdTime()` -> `java.time.OffsetDateTime createdTime()` +* `regenerateKeys(models.PolicykeyResource)` was removed + +#### `models.NamespaceResource$Definition` was modified + +* `withServiceBusEndpoint(java.lang.String)` was removed +* `withUpdatedAt(java.time.OffsetDateTime)` was removed +* `withEnabled(java.lang.Boolean)` was removed +* `withSubscriptionId(java.lang.String)` was removed +* `withLocation(java.lang.String)` was removed +* `withRegion(java.lang.String)` was removed +* `withNamePropertiesName(java.lang.String)` was removed +* `withCritical(java.lang.Boolean)` was removed +* `withStatus(java.lang.String)` was removed +* `withLocation(com.azure.core.management.Region)` was removed +* `withProvisioningState(java.lang.String)` was removed +* `withCreatedAt(java.time.OffsetDateTime)` was removed + +#### `models.NamespaceResource` was modified + +* `java.lang.String status()` -> `models.NamespaceStatus status()` +* `java.lang.String provisioningState()` -> `models.OperationProvisioningState provisioningState()` + +### Features Added + +* `models.OperationProperties` was added + +* `models.PrivateLinkConnectionStatus` was added + +* `models.PolicyKeyResource` was added + +* `models.ReplicationRegion` was added + +* `models.Availability` was added + +* `models.RemotePrivateEndpointConnection` was added + +* `models.NamespaceStatus` was added + +* `models.OperationProvisioningState` was added + +* `models.NetworkAcls` was added + +* `implementation.models.PrivateEndpointConnectionResourceListResult` was added + +* `models.RegistrationResult` was added + +* `models.BrowserCredential` was added + +* `models.PrivateEndpointConnectionProperties` was added + +* `models.FcmV1Credential` was added + +* `models.PrivateEndpointConnectionResources` was added + +* `implementation.models.OperationListResult` was added + +* `models.PrivateEndpointConnectionResource` was added + +* `models.LogSpecification` was added + +* `models.ZoneRedundancyPreference` was added + +* `models.IpRule` was added + +* `models.PrivateLinkResources` was added + +* `models.SharedAccessAuthorizationRuleResources` was added + +* `implementation.models.NamespaceListResult` was added + +* `models.PrivateLinkResourceProperties` was added + +* `NotificationhubsManager$Configurable` was added + +* `implementation.models.PrivateLinkResourceListResult` was added + +* `models.ServiceSpecification` was added + +* `models.RemotePrivateLinkServiceConnectionState` was added + +* `models.XiaomiCredential` was added + +* `models.NamespaceResources` was added + +* `implementation.models.SharedAccessAuthorizationRuleListResult` was added + +* `models.NamespacesOperationGroups` was added + +* `models.NotificationHubResources` was added + +* `implementation.models.NotificationHubListResult` was added + +* `models.PublicNetworkAccess` was added + +* `models.PrivateLinkResource` was added + +* `models.MetricSpecification` was added + +* `NotificationhubsManager` was added + +* `models.PublicInternetAuthorizationRule` was added + +* `models.PolicyKeyType` was added + +* `models.PrivateEndpointConnectionProvisioningState` was added + +#### `models.SharedAccessAuthorizationRuleResource$Definition` was modified + +* `withSecondaryKey(java.lang.String)` was added +* `withRegion(com.azure.core.management.Region)` was added +* `withTags(java.util.Map)` was added +* `withRegion(java.lang.String)` was added +* `withPrimaryKey(java.lang.String)` was added +* `withExistingNotificationHub(java.lang.String,java.lang.String,java.lang.String)` was added +* `withRights(java.util.List)` was added + +#### `models.NotificationHubResource` was modified + +* `browserCredential()` was added +* `debugSendWithResponse(com.azure.core.util.Context)` was added +* `fcmV1Credential()` was added +* `xiaomiCredential()` was added +* `systemData()` was added +* `dailyMaxActiveDevices()` was added + +#### `models.OperationDisplay` was modified + +* `description()` was added + +#### `models.NamespaceResource$Update` was modified + +* `withProperties(fluent.models.NamespaceProperties)` was added + +#### `models.DebugSendResponse` was modified + +* `systemData()` was added + +#### `models.NamespacePatchParameters` was modified + +* `withProperties(fluent.models.NamespaceProperties)` was added +* `properties()` was added + +#### `models.PnsCredentialsResource` was modified + +* `systemData()` was added +* `browserCredential()` was added +* `xiaomiCredential()` was added +* `fcmV1Credential()` was added + +#### `models.NotificationHubResource$Update` was modified + +* `withXiaomiCredential(models.XiaomiCredential)` was added +* `withBrowserCredential(models.BrowserCredential)` was added +* `withFcmV1Credential(models.FcmV1Credential)` was added + +#### `models.SharedAccessAuthorizationRuleResource$Update` was modified + +* `withSecondaryKey(java.lang.String)` was added +* `withPrimaryKey(java.lang.String)` was added +* `withRights(java.util.List)` was added +* `withTags(java.util.Map)` was added + +#### `models.Namespaces` was modified + +* `createOrUpdateAuthorizationRule(java.lang.String,java.lang.String,java.lang.String,fluent.models.SharedAccessAuthorizationRuleResourceInner)` was added +* `regenerateKeysWithResponse(java.lang.String,java.lang.String,java.lang.String,models.PolicyKeyResource,com.azure.core.util.Context)` was added +* `regenerateKeys(java.lang.String,java.lang.String,java.lang.String,models.PolicyKeyResource)` was added +* `createOrUpdateAuthorizationRuleWithResponse(java.lang.String,java.lang.String,java.lang.String,fluent.models.SharedAccessAuthorizationRuleResourceInner,com.azure.core.util.Context)` was added + +#### `models.NotificationHubPatchParameters` was modified + +* `fcmV1Credential()` was added +* `withFcmV1Credential(models.FcmV1Credential)` was added +* `browserCredential()` was added +* `withName(java.lang.String)` was added +* `xiaomiCredential()` was added +* `withBrowserCredential(models.BrowserCredential)` was added +* `withXiaomiCredential(models.XiaomiCredential)` was added +* `dailyMaxActiveDevices()` was added +* `tags()` was added + +#### `models.WnsCredential` was modified + +* `withWnsCertificate(java.lang.String)` was added +* `wnsCertificate()` was added +* `certificateKey()` was added +* `withCertificateKey(java.lang.String)` was added + +#### `models.NotificationHubResource$Definition` was modified + +* `withBrowserCredential(models.BrowserCredential)` was added +* `withFcmV1Credential(models.FcmV1Credential)` was added +* `withXiaomiCredential(models.XiaomiCredential)` was added + +#### `models.Operation` was modified + +* `properties()` was added +* `isDataAction()` was added + +#### `models.CheckAvailabilityResult` was modified + +* `systemData()` was added + +#### `models.SharedAccessAuthorizationRuleResource` was modified + +* `systemData()` was added +* `regenerateKeysWithResponse(models.PolicyKeyResource,com.azure.core.util.Context)` was added +* `regenerateKeys(models.PolicyKeyResource)` was added + +#### `models.NamespaceResource$Definition` was modified + +* `withNetworkAcls(models.NetworkAcls)` was added +* `withRegion(java.lang.String)` was added +* `withPublicNetworkAccess(models.PublicNetworkAccess)` was added +* `withZoneRedundancy(models.ZoneRedundancyPreference)` was added +* `withReplicationRegion(models.ReplicationRegion)` was added +* `withRegion(com.azure.core.management.Region)` was added +* `withStatus(models.NamespaceStatus)` was added +* `withProvisioningState(models.OperationProvisioningState)` was added +* `withPnsCredentials(fluent.models.PnsCredentials)` was added + +#### `models.NamespaceResource` was modified + +* `publicNetworkAccess()` was added +* `getPnsCredentialsWithResponse(com.azure.core.util.Context)` was added +* `privateEndpointConnections()` was added +* `zoneRedundancy()` was added +* `networkAcls()` was added +* `replicationRegion()` was added +* `checkNotificationHubAvailabilityWithResponse(models.CheckAvailabilityParameters,com.azure.core.util.Context)` was added +* `checkNotificationHubAvailability(models.CheckAvailabilityParameters)` was added +* `systemData()` was added +* `pnsCredentials()` was added +* `getPnsCredentials()` was added ## 1.0.0 (2024-12-26) diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/README.md b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/README.md index 20d5496823da..0e835421a627 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/README.md +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/README.md @@ -1,8 +1,8 @@ -# Azure Resource Manager NotificationHubs client library for Java +# Azure Resource Manager Notificationhubs client library for Java -Azure Resource Manager NotificationHubs client library for Java. +Azure Resource Manager Notificationhubs client library for Java. -This package contains Microsoft Azure SDK for NotificationHubs Management SDK. Azure NotificationHub client. Package tag package-2017-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Notificationhubs Management SDK. Microsoft Notification Hubs Resource Provider REST API. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -52,15 +52,15 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); -NotificationHubsManager manager = NotificationHubsManager +NotificationhubsManager manager = NotificationhubsManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ - - diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/SAMPLE.md b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/SAMPLE.md index a09225bdc951..48c829bf1f11 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/SAMPLE.md +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/SAMPLE.md @@ -1,802 +1,9 @@ # Code snippets and samples -## Namespaces - -- [CheckAvailability](#namespaces_checkavailability) -- [CreateOrUpdate](#namespaces_createorupdate) -- [CreateOrUpdateAuthorizationRule](#namespaces_createorupdateauthorizationrule) -- [Delete](#namespaces_delete) -- [DeleteAuthorizationRule](#namespaces_deleteauthorizationrule) -- [GetAuthorizationRule](#namespaces_getauthorizationrule) -- [GetByResourceGroup](#namespaces_getbyresourcegroup) -- [List](#namespaces_list) -- [ListAuthorizationRules](#namespaces_listauthorizationrules) -- [ListByResourceGroup](#namespaces_listbyresourcegroup) -- [ListKeys](#namespaces_listkeys) -- [Patch](#namespaces_patch) -- [RegenerateKeys](#namespaces_regeneratekeys) - -## NotificationHubs - -- [CheckNotificationHubAvailability](#notificationhubs_checknotificationhubavailability) -- [CreateOrUpdate](#notificationhubs_createorupdate) -- [CreateOrUpdateAuthorizationRule](#notificationhubs_createorupdateauthorizationrule) -- [DebugSend](#notificationhubs_debugsend) -- [Delete](#notificationhubs_delete) -- [DeleteAuthorizationRule](#notificationhubs_deleteauthorizationrule) -- [Get](#notificationhubs_get) -- [GetAuthorizationRule](#notificationhubs_getauthorizationrule) -- [GetPnsCredentials](#notificationhubs_getpnscredentials) -- [List](#notificationhubs_list) -- [ListAuthorizationRules](#notificationhubs_listauthorizationrules) -- [ListKeys](#notificationhubs_listkeys) -- [Patch](#notificationhubs_patch) -- [RegenerateKeys](#notificationhubs_regeneratekeys) - ## Operations - [List](#operations_list) -### Namespaces_CheckAvailability - -```java -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; - -/** - * Samples for Namespaces CheckAvailability. - */ -public final class NamespacesCheckAvailabilitySamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceCheckNameAvailability.json - */ - /** - * Sample code: NameSpaceCheckNameAvailability. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceCheckNameAvailability(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .checkAvailabilityWithResponse(new CheckAvailabilityParameters().withName("sdk-Namespace-2924"), - com.azure.core.util.Context.NONE); - } -} -``` - -### Namespaces_CreateOrUpdate - -```java -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.util.HashMap; -import java.util.Map; - -/** - * Samples for Namespaces CreateOrUpdate. - */ -public final class NamespacesCreateOrUpdateSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceCreate.json - */ - /** - * Sample code: NameSpaceCreate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceCreate(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .define("nh-sdk-ns") - .withLocation("South Central US") - .withExistingResourceGroup("5ktrial") - .withTags(mapOf("tag1", "value1", "tag2", "value2")) - .withSku(new Sku().withName(SkuName.STANDARD).withTier("Standard")) - .create(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} -``` - -### Namespaces_CreateOrUpdateAuthorizationRule - -```java -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; -import com.azure.resourcemanager.notificationhubs.models.AccessRights; -import java.util.Arrays; - -/** - * Samples for Namespaces CreateOrUpdateAuthorizationRule. - */ -public final class NamespacesCreateOrUpdateAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleCreate.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleCreate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleCreate(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .defineAuthorizationRule("sdk-AuthRules-1788") - .withExistingNamespace("5ktrial", "nh-sdk-ns") - .withProperties(new SharedAccessAuthorizationRuleProperties() - .withRights(Arrays.asList(AccessRights.LISTEN, AccessRights.SEND))) - .create(); - } -} -``` - -### Namespaces_Delete - -```java -/** - * Samples for Namespaces Delete. - */ -public final class NamespacesDeleteSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceDelete.json - */ - /** - * Sample code: NameSpaceDelete. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceDelete(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().delete("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE); - } -} -``` - -### Namespaces_DeleteAuthorizationRule - -```java -/** - * Samples for Namespaces DeleteAuthorizationRule. - */ -public final class NamespacesDeleteAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleDelete.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleDelete. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleDelete(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .deleteAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "RootManageSharedAccessKey", - com.azure.core.util.Context.NONE); - } -} -``` - -### Namespaces_GetAuthorizationRule - -```java -/** - * Samples for Namespaces GetAuthorizationRule. - */ -public final class NamespacesGetAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleGet.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleGet. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleGet(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .getAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "RootManageSharedAccessKey", - com.azure.core.util.Context.NONE); - } -} -``` - -### Namespaces_GetByResourceGroup - -```java -/** - * Samples for Namespaces GetByResourceGroup. - */ -public final class NamespacesGetByResourceGroupSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceGet.json - */ - /** - * Sample code: NameSpaceGet. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceGet(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().getByResourceGroupWithResponse("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE); - } -} -``` - -### Namespaces_List - -```java -/** - * Samples for Namespaces List. - */ -public final class NamespacesListSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceList.json - */ - /** - * Sample code: NameSpaceList. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceList(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().list(com.azure.core.util.Context.NONE); - } -} -``` - -### Namespaces_ListAuthorizationRules - -```java -/** - * Samples for Namespaces ListAuthorizationRules. - */ -public final class NamespacesListAuthorizationRulesSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleListAll.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleListAll. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleListAll(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().listAuthorizationRules("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE); - } -} -``` - -### Namespaces_ListByResourceGroup - -```java -/** - * Samples for Namespaces ListByResourceGroup. - */ -public final class NamespacesListByResourceGroupSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceListByResourceGroup.json - */ - /** - * Sample code: NameSpaceListByResourceGroup. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceListByResourceGroup(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().listByResourceGroup("5ktrial", com.azure.core.util.Context.NONE); - } -} -``` - -### Namespaces_ListKeys - -```java -/** - * Samples for Namespaces ListKeys. - */ -public final class NamespacesListKeysSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleListKey.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleListKey. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleListKey(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .listKeysWithResponse("5ktrial", "nh-sdk-ns", "RootManageSharedAccessKey", - com.azure.core.util.Context.NONE); - } -} -``` - -### Namespaces_Patch - -```java -import com.azure.resourcemanager.notificationhubs.models.NamespaceResource; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.util.HashMap; -import java.util.Map; - -/** - * Samples for Namespaces Patch. - */ -public final class NamespacesPatchSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceUpdate.json - */ - /** - * Sample code: NameSpaceUpdate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceUpdate(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - NamespaceResource resource = manager.namespaces() - .getByResourceGroupWithResponse("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE) - .getValue(); - resource.update() - .withTags(mapOf("tag1", "value1", "tag2", "value2")) - .withSku(new Sku().withName(SkuName.STANDARD).withTier("Standard")) - .apply(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} -``` - -### Namespaces_RegenerateKeys - -```java -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; - -/** - * Samples for Namespaces RegenerateKeys. - */ -public final class NamespacesRegenerateKeysSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleRegenrateKey.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleRegenerateKey. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceAuthorizationRuleRegenerateKey( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .regenerateKeysWithResponse("5ktrial", "nh-sdk-ns", "RootManageSharedAccessKey", - new PolicykeyResource().withPolicyKey("fakeTokenPlaceholder"), com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_CheckNotificationHubAvailability - -```java -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; - -/** - * Samples for NotificationHubs CheckNotificationHubAvailability. - */ -public final class NotificationHubsCheckNotificationHubAvailabilitySamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubCheckNameAvailability.json - */ - /** - * Sample code: notificationHubCheckNameAvailability. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubCheckNameAvailability( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .checkNotificationHubAvailabilityWithResponse("5ktrial", "locp-newns", - new CheckAvailabilityParameters().withName("sdktest").withLocation("West Europe"), - com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_CreateOrUpdate - -```java -/** - * Samples for NotificationHubs CreateOrUpdate. - */ -public final class NotificationHubsCreateOrUpdateSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubCreate.json - */ - /** - * Sample code: NotificationHubCreate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubCreate(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .define("nh-sdk-hub") - .withRegion("eastus") - .withExistingNamespace("5ktrial", "nh-sdk-ns") - .create(); - } -} -``` - -### NotificationHubs_CreateOrUpdateAuthorizationRule - -```java -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; -import com.azure.resourcemanager.notificationhubs.models.AccessRights; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters; -import java.util.Arrays; - -/** - * Samples for NotificationHubs CreateOrUpdateAuthorizationRule. - */ -public final class NotificationHubsCreateOrUpdateAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleCreate.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleCreate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleCreate( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .createOrUpdateAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", - "DefaultListenSharedAccessSignature", - new SharedAccessAuthorizationRuleCreateOrUpdateParameters() - .withProperties(new SharedAccessAuthorizationRuleProperties() - .withRights(Arrays.asList(AccessRights.LISTEN, AccessRights.SEND))), - com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_DebugSend - -```java -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; - -/** - * Samples for NotificationHubs DebugSend. - */ -public final class NotificationHubsDebugSendSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubDebugSend.json - */ - /** - * Sample code: debugsend. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void debugsend(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) - throws IOException { - manager.notificationHubs() - .debugSendWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", - SerializerFactory.createDefaultManagementSerializerAdapter() - .deserialize("{\"data\":{\"message\":\"Hello\"}}", Object.class, SerializerEncoding.JSON), - com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_Delete - -```java -/** - * Samples for NotificationHubs Delete. - */ -public final class NotificationHubsDeleteSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubDelete.json - */ - /** - * Sample code: NotificationHubDelete. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubDelete(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .deleteWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_DeleteAuthorizationRule - -```java -/** - * Samples for NotificationHubs DeleteAuthorizationRule. - */ -public final class NotificationHubsDeleteAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleDelete.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleDelete. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleDelete( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .deleteAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", - "DefaultListenSharedAccessSignature", com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_Get - -```java -/** - * Samples for NotificationHubs Get. - */ -public final class NotificationHubsGetSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubGet.json - */ - /** - * Sample code: NotificationHubGet. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubGet(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .getWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_GetAuthorizationRule - -```java -/** - * Samples for NotificationHubs GetAuthorizationRule. - */ -public final class NotificationHubsGetAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleGet.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleGet. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleGet( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .getAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", - "DefaultListenSharedAccessSignature", com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_GetPnsCredentials - -```java -/** - * Samples for NotificationHubs GetPnsCredentials. - */ -public final class NotificationHubsGetPnsCredentialsSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubPnsCredentials.json - */ - /** - * Sample code: notificationHubPnsCredentials. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubPnsCredentials(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .getPnsCredentialsWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_List - -```java -/** - * Samples for NotificationHubs List. - */ -public final class NotificationHubsListSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubListByNameSpace.json - */ - /** - * Sample code: NotificationHubListByNameSpace. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubListByNameSpace(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs().list("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_ListAuthorizationRules - -```java -/** - * Samples for NotificationHubs ListAuthorizationRules. - */ -public final class NotificationHubsListAuthorizationRulesSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleListAll.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleListAll. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleListAll( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .listAuthorizationRules("5ktrial", "nh-sdk-ns", "nh-sdk-hub", com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_ListKeys - -```java -/** - * Samples for NotificationHubs ListKeys. - */ -public final class NotificationHubsListKeysSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleListKey.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleListKey. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleListKey( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .listKeysWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", "sdk-AuthRules-5800", - com.azure.core.util.Context.NONE); - } -} -``` - -### NotificationHubs_Patch - -```java -import com.azure.resourcemanager.notificationhubs.models.NotificationHubResource; - -/** - * Samples for NotificationHubs Patch. - */ -public final class NotificationHubsPatchSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubPatch.json - */ - /** - * Sample code: NotificationHubPatch. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubPatch(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - NotificationHubResource resource = manager.notificationHubs() - .getWithResponse("sdkresourceGroup", "nh-sdk-ns", "sdk-notificationHubs-8708", - com.azure.core.util.Context.NONE) - .getValue(); - resource.update().apply(); - } -} -``` - -### NotificationHubs_RegenerateKeys - -```java -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; - -/** - * Samples for NotificationHubs RegenerateKeys. - */ -public final class NotificationHubsRegenerateKeysSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleRegenrateKey.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleRegenrateKey. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleRegenrateKey( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .regenerateKeysWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", "DefaultListenSharedAccessSignature", - new PolicykeyResource().withPolicyKey("fakeTokenPlaceholder"), com.azure.core.util.Context.NONE); - } -} -``` - ### Operations_List ```java @@ -805,16 +12,14 @@ public final class NotificationHubsRegenerateKeysSamples { */ public final class OperationsListSamples { /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NHOperationsList.json + * x-ms-original-file: 2023-10-01-preview/NHOperationsList.json */ /** - * Sample code: OperationsList. + * Sample code: Operations_List. * - * @param manager Entry point to NotificationHubsManager. + * @param manager Entry point to NotificationhubsManager. */ - public static void operationsList(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { + public static void operationsList(com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager) { manager.operations().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/pom.xml b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/pom.xml index 57b5739877bb..c017f86ea73c 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/pom.xml +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/pom.xml @@ -1,7 +1,7 @@ 4.0.0 @@ -17,8 +17,8 @@ 1.1.0-beta.1 jar - Microsoft Azure SDK for NotificationHubs Management - This package contains Microsoft Azure SDK for NotificationHubs Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure NotificationHub client. Package tag package-2017-04. + Microsoft Azure SDK for Notificationhubs Management + This package contains Microsoft Azure SDK for Notificationhubs Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft Notification Hubs Resource Provider REST API. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,7 @@ UTF-8 0 0 - false + true diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/NotificationHubsManager.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/NotificationhubsManager.java similarity index 63% rename from sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/NotificationHubsManager.java rename to sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/NotificationhubsManager.java index 25fc305c8164..6afe2885efea 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/NotificationHubsManager.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/NotificationhubsManager.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs; @@ -22,39 +22,61 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.notificationhubs.fluent.NotificationHubsManagementClient; +import com.azure.resourcemanager.notificationhubs.fluent.NotificationHubsClient; +import com.azure.resourcemanager.notificationhubs.implementation.NamespaceResourcesImpl; import com.azure.resourcemanager.notificationhubs.implementation.NamespacesImpl; -import com.azure.resourcemanager.notificationhubs.implementation.NotificationHubsImpl; -import com.azure.resourcemanager.notificationhubs.implementation.NotificationHubsManagementClientBuilder; +import com.azure.resourcemanager.notificationhubs.implementation.NamespacesOperationGroupsImpl; +import com.azure.resourcemanager.notificationhubs.implementation.NotificationHubResourcesImpl; +import com.azure.resourcemanager.notificationhubs.implementation.NotificationHubsClientBuilder; import com.azure.resourcemanager.notificationhubs.implementation.OperationsImpl; +import com.azure.resourcemanager.notificationhubs.implementation.PrivateEndpointConnectionResourcesImpl; +import com.azure.resourcemanager.notificationhubs.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.notificationhubs.implementation.SharedAccessAuthorizationRuleResourcesImpl; +import com.azure.resourcemanager.notificationhubs.models.NamespaceResources; import com.azure.resourcemanager.notificationhubs.models.Namespaces; -import com.azure.resourcemanager.notificationhubs.models.NotificationHubs; +import com.azure.resourcemanager.notificationhubs.models.NamespacesOperationGroups; +import com.azure.resourcemanager.notificationhubs.models.NotificationHubResources; import com.azure.resourcemanager.notificationhubs.models.Operations; +import com.azure.resourcemanager.notificationhubs.models.PrivateEndpointConnectionResources; +import com.azure.resourcemanager.notificationhubs.models.PrivateLinkResources; +import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleResources; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; /** - * Entry point to NotificationHubsManager. - * Azure NotificationHub client. + * Entry point to NotificationhubsManager. + * Microsoft Notification Hubs Resource Provider REST API. */ -public final class NotificationHubsManager { +public final class NotificationhubsManager { private Operations operations; + private NotificationHubResources notificationHubResources; + + private NamespaceResources namespaceResources; + + private SharedAccessAuthorizationRuleResources sharedAccessAuthorizationRuleResources; + private Namespaces namespaces; - private NotificationHubs notificationHubs; + private PrivateEndpointConnectionResources privateEndpointConnectionResources; + + private PrivateLinkResources privateLinkResources; + + private NamespacesOperationGroups namespacesOperationGroups; - private final NotificationHubsManagementClient clientObject; + private final NotificationHubsClient clientObject; - private NotificationHubsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + private NotificationhubsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new NotificationHubsManagementClientBuilder().pipeline(httpPipeline) + this.clientObject = new NotificationHubsClientBuilder().pipeline(httpPipeline) .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) .subscriptionId(profile.getSubscriptionId()) .defaultPollInterval(defaultPollInterval) @@ -62,38 +84,38 @@ private NotificationHubsManager(HttpPipeline httpPipeline, AzureProfile profile, } /** - * Creates an instance of NotificationHubs service API entry point. + * Creates an instance of Notificationhubs service API entry point. * * @param credential the credential to use. * @param profile the Azure profile for client. - * @return the NotificationHubs service API instance. + * @return the Notificationhubs service API instance. */ - public static NotificationHubsManager authenticate(TokenCredential credential, AzureProfile profile) { + public static NotificationhubsManager authenticate(TokenCredential credential, AzureProfile profile) { Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); return configure().authenticate(credential, profile); } /** - * Creates an instance of NotificationHubs service API entry point. + * Creates an instance of Notificationhubs service API entry point. * * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. * @param profile the Azure profile for client. - * @return the NotificationHubs service API instance. + * @return the Notificationhubs service API instance. */ - public static NotificationHubsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + public static NotificationhubsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); - return new NotificationHubsManager(httpPipeline, profile, null); + return new NotificationhubsManager(httpPipeline, profile, null); } /** - * Gets a Configurable instance that can be used to create NotificationHubsManager with optional configuration. + * Gets a Configurable instance that can be used to create NotificationhubsManager with optional configuration. * * @return the Configurable instance allowing configurations. */ public static Configurable configure() { - return new NotificationHubsManager.Configurable(); + return new NotificationhubsManager.Configurable(); } /** @@ -101,6 +123,9 @@ public static Configurable configure() { */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-notificationhubs.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -198,22 +223,24 @@ public Configurable withDefaultPollInterval(Duration defaultPollInterval) { } /** - * Creates an instance of NotificationHubs service API entry point. + * Creates an instance of Notificationhubs service API entry point. * * @param credential the credential to use. * @param profile the Azure profile for client. - * @return the NotificationHubs service API instance. + * @return the Notificationhubs service API instance. */ - public NotificationHubsManager authenticate(TokenCredential credential, AzureProfile profile) { + public NotificationhubsManager authenticate(TokenCredential credential, AzureProfile profile) { Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + StringBuilder userAgentBuilder = new StringBuilder(); userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.notificationhubs") .append("/") - .append("1.0.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -255,7 +282,7 @@ public NotificationHubsManager authenticate(TokenCredential credential, AzurePro HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) .policies(policies.toArray(new HttpPipelinePolicy[0])) .build(); - return new NotificationHubsManager(httpPipeline, profile, defaultPollInterval); + return new NotificationhubsManager(httpPipeline, profile, defaultPollInterval); } } @@ -272,9 +299,47 @@ public Operations operations() { } /** - * Gets the resource collection API of Namespaces. It manages NamespaceResource, + * Gets the resource collection API of NotificationHubResources. It manages NotificationHubResource. + * + * @return Resource collection API of NotificationHubResources. + */ + public NotificationHubResources notificationHubResources() { + if (this.notificationHubResources == null) { + this.notificationHubResources + = new NotificationHubResourcesImpl(clientObject.getNotificationHubResources(), this); + } + return notificationHubResources; + } + + /** + * Gets the resource collection API of NamespaceResources. It manages NamespaceResource. + * + * @return Resource collection API of NamespaceResources. + */ + public NamespaceResources namespaceResources() { + if (this.namespaceResources == null) { + this.namespaceResources = new NamespaceResourcesImpl(clientObject.getNamespaceResources(), this); + } + return namespaceResources; + } + + /** + * Gets the resource collection API of SharedAccessAuthorizationRuleResources. It manages * SharedAccessAuthorizationRuleResource. * + * @return Resource collection API of SharedAccessAuthorizationRuleResources. + */ + public SharedAccessAuthorizationRuleResources sharedAccessAuthorizationRuleResources() { + if (this.sharedAccessAuthorizationRuleResources == null) { + this.sharedAccessAuthorizationRuleResources = new SharedAccessAuthorizationRuleResourcesImpl( + clientObject.getSharedAccessAuthorizationRuleResources(), this); + } + return sharedAccessAuthorizationRuleResources; + } + + /** + * Gets the resource collection API of Namespaces. + * * @return Resource collection API of Namespaces. */ public Namespaces namespaces() { @@ -285,24 +350,50 @@ public Namespaces namespaces() { } /** - * Gets the resource collection API of NotificationHubs. It manages NotificationHubResource. + * Gets the resource collection API of PrivateEndpointConnectionResources. + * + * @return Resource collection API of PrivateEndpointConnectionResources. + */ + public PrivateEndpointConnectionResources privateEndpointConnectionResources() { + if (this.privateEndpointConnectionResources == null) { + this.privateEndpointConnectionResources = new PrivateEndpointConnectionResourcesImpl( + clientObject.getPrivateEndpointConnectionResources(), this); + } + return privateEndpointConnectionResources; + } + + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * Gets the resource collection API of NamespacesOperationGroups. * - * @return Resource collection API of NotificationHubs. + * @return Resource collection API of NamespacesOperationGroups. */ - public NotificationHubs notificationHubs() { - if (this.notificationHubs == null) { - this.notificationHubs = new NotificationHubsImpl(clientObject.getNotificationHubs(), this); + public NamespacesOperationGroups namespacesOperationGroups() { + if (this.namespacesOperationGroups == null) { + this.namespacesOperationGroups + = new NamespacesOperationGroupsImpl(clientObject.getNamespacesOperationGroups(), this); } - return notificationHubs; + return namespacesOperationGroups; } /** - * Gets wrapped service client NotificationHubsManagementClient providing direct access to the underlying - * auto-generated API implementation, based on Azure REST API. + * Gets wrapped service client NotificationHubsClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. * - * @return Wrapped service client NotificationHubsManagementClient. + * @return Wrapped service client NotificationHubsClient. */ - public NotificationHubsManagementClient serviceClient() { + public NotificationHubsClient serviceClient() { return this.clientObject; } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespaceResourcesClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespaceResourcesClient.java new file mode 100644 index 000000000000..57080b304b52 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespaceResourcesClient.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; +import com.azure.resourcemanager.notificationhubs.models.NamespacePatchParameters; + +/** + * An instance of this class provides access to all the operations defined in NamespaceResourcesClient. + */ +public interface NamespaceResourcesClient { + /** + * Returns the given namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String namespaceName, + Context context); + + /** + * Returns the given namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NamespaceResourceInner getByResourceGroup(String resourceGroupName, String namespaceName); + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NamespaceResourceInner> beginCreateOrUpdate(String resourceGroupName, + String namespaceName, NamespaceResourceInner parameters); + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NamespaceResourceInner> beginCreateOrUpdate(String resourceGroupName, + String namespaceName, NamespaceResourceInner parameters, Context context); + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NamespaceResourceInner createOrUpdate(String resourceGroupName, String namespaceName, + NamespaceResourceInner parameters); + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NamespaceResourceInner createOrUpdate(String resourceGroupName, String namespaceName, + NamespaceResourceInner parameters, Context context); + + /** + * Patches the existing namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String namespaceName, + NamespacePatchParameters parameters, Context context); + + /** + * Patches the existing namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NamespaceResourceInner update(String resourceGroupName, String namespaceName, NamespacePatchParameters parameters); + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String namespaceName, Context context); + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String namespaceName); + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String skipToken, Integer top, + Context context); + + /** + * Lists all the available namespaces within the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the available namespaces within the subscription. + * + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String skipToken, Integer top, Context context); + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNotificationHubAvailabilityWithResponse(String resourceGroupName, + String namespaceName, CheckAvailabilityParameters parameters, Context context); + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckAvailabilityResultInner checkNotificationHubAvailability(String resourceGroupName, String namespaceName, + CheckAvailabilityParameters parameters); + + /** + * Lists the PNS credentials associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPnsCredentialsWithResponse(String resourceGroupName, String namespaceName, + Context context); + + /** + * Lists the PNS credentials associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PnsCredentialsResourceInner getPnsCredentials(String resourceGroupName, String namespaceName); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespacesClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespacesClient.java index 2ea7f3869b18..fe793c084008 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespacesClient.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespacesClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent; @@ -8,235 +8,86 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; -import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; import com.azure.resourcemanager.notificationhubs.fluent.models.ResourceListKeysInner; import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; -import com.azure.resourcemanager.notificationhubs.models.NamespaceCreateOrUpdateParameters; -import com.azure.resourcemanager.notificationhubs.models.NamespacePatchParameters; -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters; +import com.azure.resourcemanager.notificationhubs.models.PolicyKeyResource; /** * An instance of this class provides access to all the operations defined in NamespacesClient. */ public interface NamespacesClient { /** - * 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. - * - * @param parameters The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response checkAvailabilityWithResponse(CheckAvailabilityParameters parameters, - Context context); - - /** - * 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. - * - * @param parameters The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - CheckAvailabilityResultInner checkAvailability(CheckAvailabilityParameters parameters); - - /** - * Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This - * operation is idempotent. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to create a Namespace Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse(String resourceGroupName, String namespaceName, - NamespaceCreateOrUpdateParameters parameters, Context context); - - /** - * Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This - * operation is idempotent. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to create a Namespace Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NamespaceResourceInner createOrUpdate(String resourceGroupName, String namespaceName, - NamespaceCreateOrUpdateParameters parameters); - - /** - * Patches the existing namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to patch a Namespace Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response patchWithResponse(String resourceGroupName, String namespaceName, - NamespacePatchParameters parameters, Context context); - - /** - * Patches the existing namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to patch a Namespace Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NamespaceResourceInner patch(String resourceGroupName, String namespaceName, NamespacePatchParameters parameters); - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String namespaceName); - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String namespaceName, Context context); - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String namespaceName); - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String namespaceName, Context context); - - /** - * Returns the description for the specified namespace. + * Gets an authorization rule for a namespace by name. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response}. + * @return an authorization rule for a namespace by name along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, String namespaceName, - Context context); + Response getAuthorizationRuleWithResponse(String resourceGroupName, + String namespaceName, String authorizationRuleName, Context context); /** - * Returns the description for the specified namespace. + * Gets an authorization rule for a namespace by name. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource. + * @return an authorization rule for a namespace by name. */ @ServiceMethod(returns = ReturnType.SINGLE) - NamespaceResourceInner getByResourceGroup(String resourceGroupName, String namespaceName); + SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, String namespaceName, + String authorizationRuleName); /** * Creates an authorization rule for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules along with {@link Response}. + * @return response for POST requests that return single SharedAccessAuthorizationRule along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response createOrUpdateAuthorizationRuleWithResponse( String resourceGroupName, String namespaceName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, Context context); + SharedAccessAuthorizationRuleResourceInner parameters, Context context); /** * Creates an authorization rule for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules. + * @return response for POST requests that return single SharedAccessAuthorizationRule. */ @ServiceMethod(returns = ReturnType.SINGLE) SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, - String namespaceName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters); + String namespaceName, String authorizationRuleName, SharedAccessAuthorizationRuleResourceInner parameters); /** * Deletes a namespace authorization rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -250,9 +101,9 @@ Response deleteAuthorizationRuleWithResponse(String resourceGroupName, Str /** * Deletes a namespace authorization rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -260,91 +111,11 @@ Response deleteAuthorizationRuleWithResponse(String resourceGroupName, Str @ServiceMethod(returns = ReturnType.SINGLE) void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName); - /** - * Gets an authorization rule for a namespace by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization rule name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getAuthorizationRuleWithResponse(String resourceGroupName, - String namespaceName, String authorizationRuleName, Context context); - - /** - * Gets an authorization rule for a namespace by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, String namespaceName, - String authorizationRuleName); - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - /** * Gets the authorization rules for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -357,8 +128,8 @@ PagedIterable listAuthorizationRules /** * Gets the authorization rules for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -372,9 +143,9 @@ PagedIterable listAuthorizationRules /** * Gets the Primary and Secondary ConnectionStrings to the namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -388,9 +159,9 @@ Response listKeysWithResponse(String resourceGroupName, S /** * Gets the Primary and Secondary ConnectionStrings to the namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -402,33 +173,34 @@ Response listKeysWithResponse(String resourceGroupName, S /** * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response}. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, - String authorizationRuleName, PolicykeyResource parameters, Context context); + String authorizationRuleName, PolicyKeyResource parameters, Context context); /** * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings). */ @ServiceMethod(returns = ReturnType.SINGLE) ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String authorizationRuleName, - PolicykeyResource parameters); + PolicyKeyResource parameters); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespacesOperationGroupsClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespacesOperationGroupsClient.java new file mode 100644 index 000000000000..efbfa0ce56ec --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NamespacesOperationGroupsClient.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; + +/** + * An instance of this class provides access to all the operations defined in NamespacesOperationGroupsClient. + */ +public interface NamespacesOperationGroupsClient { + /** + * 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. + * + * @param parameters The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkAvailabilityWithResponse(CheckAvailabilityParameters parameters, + Context context); + + /** + * 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. + * + * @param parameters The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckAvailabilityResultInner checkAvailability(CheckAvailabilityParameters parameters); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubResourcesClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubResourcesClient.java new file mode 100644 index 000000000000..e26a7dfc5af9 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubResourcesClient.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubResourceInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; +import com.azure.resourcemanager.notificationhubs.models.NotificationHubPatchParameters; + +/** + * An instance of this class provides access to all the operations defined in NotificationHubResourcesClient. + */ +public interface NotificationHubResourcesClient { + /** + * Gets the notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context); + + /** + * Gets the notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotificationHubResourceInner get(String resourceGroupName, String namespaceName, String notificationHubName); + + /** + * Creates/Update a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, NotificationHubResourceInner parameters, Context context); + + /** + * Creates/Update a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotificationHubResourceInner createOrUpdate(String resourceGroupName, String namespaceName, + String notificationHubName, NotificationHubResourceInner parameters); + + /** + * Patch a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, NotificationHubPatchParameters parameters, Context context); + + /** + * Patch a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotificationHubResourceInner update(String resourceGroupName, String namespaceName, String notificationHubName, + NotificationHubPatchParameters parameters); + + /** + * Deletes a notification hub associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String namespaceName, String notificationHubName, + Context context); + + /** + * Deletes a notification hub associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String namespaceName, String notificationHubName); + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String namespaceName); + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param skipToken Continuation token. + * @param top Page size. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String namespaceName, String skipToken, + Integer top, Context context); + + /** + * Test send a push notification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response debugSendWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context); + + /** + * Test send a push notification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DebugSendResponseInner debugSend(String resourceGroupName, String namespaceName, String notificationHubName); + + /** + * Lists the PNS Credentials associated with a notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPnsCredentialsWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context); + + /** + * Lists the PNS Credentials associated with a notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PnsCredentialsResourceInner getPnsCredentials(String resourceGroupName, String namespaceName, + String notificationHubName); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubsClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubsClient.java index 6a63e97b7a9b..f05cbfd4fff3 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubsClient.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubsClient.java @@ -1,471 +1,104 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubResourceInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.ResourceListKeysInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; -import com.azure.resourcemanager.notificationhubs.models.NotificationHubCreateOrUpdateParameters; -import com.azure.resourcemanager.notificationhubs.models.NotificationHubPatchParameters; -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters; +import com.azure.core.http.HttpPipeline; +import java.time.Duration; /** - * An instance of this class provides access to all the operations defined in NotificationHubsClient. + * The interface for NotificationHubsClient class. */ public interface NotificationHubsClient { /** - * Checks the availability of the given notificationHub in a namespace. + * Gets Service host. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters The notificationHub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response}. + * @return the endpoint value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response checkNotificationHubAvailabilityWithResponse(String resourceGroupName, - String namespaceName, CheckAvailabilityParameters parameters, Context context); + String getEndpoint(); /** - * Checks the availability of the given notificationHub in a namespace. + * Gets Version parameter. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters The notificationHub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource. + * @return the apiVersion value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - CheckAvailabilityResultInner checkNotificationHubAvailability(String resourceGroupName, String namespaceName, - CheckAvailabilityParameters parameters); + String getApiVersion(); /** - * Creates/Update a NotificationHub in a namespace. + * Gets The ID of the target subscription. The value must be an UUID. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to the create/update a NotificationHub Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. + * @return the subscriptionId value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, NotificationHubCreateOrUpdateParameters parameters, Context context); + String getSubscriptionId(); /** - * Creates/Update a NotificationHub in a namespace. + * Gets The HTTP pipeline to send requests through. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to the create/update a NotificationHub Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. + * @return the httpPipeline value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - NotificationHubResourceInner createOrUpdate(String resourceGroupName, String namespaceName, - String notificationHubName, NotificationHubCreateOrUpdateParameters parameters); + HttpPipeline getHttpPipeline(); /** - * Patch a NotificationHub in a namespace. + * Gets The default poll interval for long-running operation. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to patch a NotificationHub Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. + * @return the defaultPollInterval value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response patchWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, NotificationHubPatchParameters parameters, Context context); + Duration getDefaultPollInterval(); /** - * Patch a NotificationHub in a namespace. + * Gets the OperationsClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. + * @return the OperationsClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - NotificationHubResourceInner patch(String resourceGroupName, String namespaceName, String notificationHubName); + OperationsClient getOperations(); /** - * Deletes a notification hub associated with a namespace. + * Gets the NotificationHubResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return the NotificationHubResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String namespaceName, String notificationHubName, - Context context); + NotificationHubResourcesClient getNotificationHubResources(); /** - * Deletes a notification hub associated with a namespace. + * Gets the NamespaceResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the NamespaceResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String namespaceName, String notificationHubName); + NamespaceResourcesClient getNamespaceResources(); /** - * Lists the notification hubs associated with a namespace. + * Gets the SharedAccessAuthorizationRuleResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. + * @return the SharedAccessAuthorizationRuleResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Context context); + SharedAccessAuthorizationRuleResourcesClient getSharedAccessAuthorizationRuleResources(); /** - * Lists the notification hubs associated with a namespace. + * Gets the NamespacesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. + * @return the NamespacesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - NotificationHubResourceInner get(String resourceGroupName, String namespaceName, String notificationHubName); + NamespacesClient getNamespaces(); /** - * test send a push notification. + * Gets the PrivateEndpointConnectionResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Debug send parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. + * @return the PrivateEndpointConnectionResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response debugSendWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Object parameters, Context context); + PrivateEndpointConnectionResourcesClient getPrivateEndpointConnectionResources(); /** - * test send a push notification. + * Gets the PrivateLinkResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. + * @return the PrivateLinkResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - DebugSendResponseInner debugSend(String resourceGroupName, String namespaceName, String notificationHubName); + PrivateLinkResourcesClient getPrivateLinkResources(); /** - * Creates/Updates an authorization rule for a NotificationHub. + * Gets the NamespacesOperationGroupsClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules along with {@link Response}. + * @return the NamespacesOperationGroupsClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateAuthorizationRuleWithResponse( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, Context context); - - /** - * Creates/Updates an authorization rule for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters); - - /** - * Deletes a notificationHub authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteAuthorizationRuleWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, Context context); - - /** - * Deletes a notificationHub authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, - String authorizationRuleName); - - /** - * Gets an authorization rule for a NotificationHub by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName authorization rule name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a NotificationHub by name along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getAuthorizationRuleWithResponse(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, Context context); - - /** - * Gets an authorization rule for a NotificationHub by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a NotificationHub by name. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName); - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String resourceGroupName, String namespaceName); - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String resourceGroupName, String namespaceName, Context context); - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listAuthorizationRules(String resourceGroupName, - String namespaceName, String notificationHubName); - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listAuthorizationRules(String resourceGroupName, - String namespaceName, String notificationHubName, Context context); - - /** - * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response listKeysWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, Context context); - - /** - * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the NotificationHub. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ResourceListKeysInner listKeys(String resourceGroupName, String namespaceName, String notificationHubName, - String authorizationRuleName); - - /** - * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, PolicykeyResource parameters, Context context); - - /** - * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String notificationHubName, - String authorizationRuleName, PolicykeyResource parameters); - - /** - * Lists the PNS Credentials associated with a notification hub . - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub PNS Credentials along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getPnsCredentialsWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Context context); - - /** - * Lists the PNS Credentials associated with a notification hub . - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub PNS Credentials. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - PnsCredentialsResourceInner getPnsCredentials(String resourceGroupName, String namespaceName, - String notificationHubName); + NamespacesOperationGroupsClient getNamespacesOperationGroups(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubsManagementClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubsManagementClient.java deleted file mode 100644 index 7dd2795a0df1..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/NotificationHubsManagementClient.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for NotificationHubsManagementClient class. - */ -public interface NotificationHubsManagementClient { - /** - * Gets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID - * forms part of the URI for every service call. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets server parameter. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - OperationsClient getOperations(); - - /** - * Gets the NamespacesClient object to access its operations. - * - * @return the NamespacesClient object. - */ - NamespacesClient getNamespaces(); - - /** - * Gets the NotificationHubsClient object to access its operations. - * - * @return the NotificationHubsClient object. - */ - NotificationHubsClient getNotificationHubs(); -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/OperationsClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/OperationsClient.java index 50e960c50d3c..770758dc2f86 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/OperationsClient.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/OperationsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent; @@ -15,25 +15,23 @@ */ public interface OperationsClient { /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations as paginated response with - * {@link PagedIterable}. + * @return paged collection of Operation items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations as paginated response with - * {@link PagedIterable}. + * @return paged collection of Operation items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/PrivateEndpointConnectionResourcesClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/PrivateEndpointConnectionResourcesClient.java new file mode 100644 index 000000000000..057d14305642 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/PrivateEndpointConnectionResourcesClient.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateEndpointConnectionResourceInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionResourcesClient. + */ +public interface PrivateEndpointConnectionResourcesClient { + /** + * Returns a Private Endpoint Connection with a given name. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, Context context); + + /** + * Returns a Private Endpoint Connection with a given name. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionResourceInner get(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName); + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Private Endpoint Connection ARM resource - a + * sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionResourceInner> beginUpdate( + String resourceGroupName, String namespaceName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner parameters); + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Private Endpoint Connection ARM resource - a + * sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionResourceInner> beginUpdate( + String resourceGroupName, String namespaceName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner parameters, Context context); + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionResourceInner update(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters); + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionResourceInner update(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters, Context context); + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName); + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, Context context); + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String namespaceName, String privateEndpointConnectionName); + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String namespaceName, String privateEndpointConnectionName, Context context); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String namespaceName); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String namespaceName, + Context context); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/PrivateLinkResourcesClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 000000000000..bf6db1c0d776 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateLinkResourceInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public interface PrivateLinkResourcesClient { + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param subResourceName Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Private Link Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGroupIdWithResponse(String resourceGroupName, String namespaceName, + String subResourceName, Context context); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param subResourceName Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Private Link Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner getGroupId(String resourceGroupName, String namespaceName, String subResourceName); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGroupIds(String resourceGroupName, String namespaceName); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGroupIds(String resourceGroupName, String namespaceName, + Context context); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/SharedAccessAuthorizationRuleResourcesClient.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/SharedAccessAuthorizationRuleResourcesClient.java new file mode 100644 index 000000000000..30d681f3e00a --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/SharedAccessAuthorizationRuleResourcesClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.notificationhubs.fluent.models.ResourceListKeysInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; +import com.azure.resourcemanager.notificationhubs.models.PolicyKeyResource; + +/** + * An instance of this class provides access to all the operations defined in + * SharedAccessAuthorizationRuleResourcesClient. + */ +public interface SharedAccessAuthorizationRuleResourcesClient { + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAuthorizationRuleWithResponse(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName, Context context); + + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName); + + /** + * Creates/Updates an authorization rule for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for POST requests that return single SharedAccessAuthorizationRule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateAuthorizationRuleWithResponse( + String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters, Context context); + + /** + * Creates/Updates an authorization rule for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for POST requests that return single SharedAccessAuthorizationRule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters); + + /** + * Deletes a notificationHub authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteAuthorizationRuleWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, Context context); + + /** + * Deletes a notificationHub authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, + String authorizationRuleName); + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAuthorizationRules(String resourceGroupName, + String namespaceName, String notificationHubName); + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAuthorizationRules(String resourceGroupName, + String namespaceName, String notificationHubName, Context context); + + /** + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, Context context); + + /** + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceListKeysInner listKeys(String resourceGroupName, String namespaceName, String notificationHubName, + String authorizationRuleName); + + /** + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, PolicyKeyResource parameters, Context context); + + /** + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, String notificationHubName, + String authorizationRuleName, PolicyKeyResource parameters); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/AdmCredentialProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/AdmCredentialProperties.java index fe9938c9bf3f..9539044239a0 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/AdmCredentialProperties.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/AdmCredentialProperties.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,17 +18,17 @@ @Fluent public final class AdmCredentialProperties implements JsonSerializable { /* - * The client identifier. + * Gets or sets the client identifier. */ private String clientId; /* - * The credential secret access key. + * Gets or sets the credential secret access key. */ private String clientSecret; /* - * The URL of the authorization token. + * Gets or sets the URL of the authorization token. */ private String authTokenUrl; @@ -38,7 +39,7 @@ public AdmCredentialProperties() { } /** - * Get the clientId property: The client identifier. + * Get the clientId property: Gets or sets the client identifier. * * @return the clientId value. */ @@ -47,7 +48,7 @@ public String clientId() { } /** - * Set the clientId property: The client identifier. + * Set the clientId property: Gets or sets the client identifier. * * @param clientId the clientId value to set. * @return the AdmCredentialProperties object itself. @@ -58,7 +59,7 @@ public AdmCredentialProperties withClientId(String clientId) { } /** - * Get the clientSecret property: The credential secret access key. + * Get the clientSecret property: Gets or sets the credential secret access key. * * @return the clientSecret value. */ @@ -67,7 +68,7 @@ public String clientSecret() { } /** - * Set the clientSecret property: The credential secret access key. + * Set the clientSecret property: Gets or sets the credential secret access key. * * @param clientSecret the clientSecret value to set. * @return the AdmCredentialProperties object itself. @@ -78,7 +79,7 @@ public AdmCredentialProperties withClientSecret(String clientSecret) { } /** - * Get the authTokenUrl property: The URL of the authorization token. + * Get the authTokenUrl property: Gets or sets the URL of the authorization token. * * @return the authTokenUrl value. */ @@ -87,7 +88,7 @@ public String authTokenUrl() { } /** - * Set the authTokenUrl property: The URL of the authorization token. + * Set the authTokenUrl property: Gets or sets the URL of the authorization token. * * @param authTokenUrl the authTokenUrl value to set. * @return the AdmCredentialProperties object itself. @@ -103,8 +104,25 @@ public AdmCredentialProperties withAuthTokenUrl(String authTokenUrl) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (clientId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property clientId in model AdmCredentialProperties")); + } + if (clientSecret() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property clientSecret in model AdmCredentialProperties")); + } + if (authTokenUrl() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property authTokenUrl in model AdmCredentialProperties")); + } } + private static final ClientLogger LOGGER = new ClientLogger(AdmCredentialProperties.class); + /** * {@inheritDoc} */ @@ -123,6 +141,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of AdmCredentialProperties if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the AdmCredentialProperties. */ public static AdmCredentialProperties fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/ApnsCredentialProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/ApnsCredentialProperties.java index 036286f9389f..d29d8e1dac4e 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/ApnsCredentialProperties.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/ApnsCredentialProperties.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -12,55 +13,50 @@ import java.io.IOException; /** - * Description of a NotificationHub ApnsCredential. Note that there is no explicit switch between Certificate and Token - * Authentication Modes. The mode is determined based on the properties passed in. + * Description of a NotificationHub ApnsCredential. */ @Fluent public final class ApnsCredentialProperties implements JsonSerializable { /* - * The APNS certificate. Specify if using Certificate Authentication Mode. + * Gets or sets the APNS certificate. */ private String apnsCertificate; /* - * The APNS certificate password if it exists. + * Gets or sets the certificate key. */ private String certificateKey; /* - * 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'. + * Gets or sets the endpoint of this credential. */ private String endpoint; /* - * The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. + * Gets or sets the APNS certificate Thumbprint */ private String thumbprint; /* - * A 10-character key identifier (kid) key, obtained from your developer account. Specify if using Token - * Authentication Mode. + * Gets or sets a 10-character key identifier (kid) key, obtained from + * your developer account */ private String keyId; /* - * The name of the application or BundleId. Specify if using Token Authentication Mode. + * Gets or sets the name of the application */ private String appName; /* - * The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from your developer account. - * Specify if using Token Authentication Mode. + * Gets or sets the issuer (iss) registered claim key, whose value is + * your 10-character Team ID, obtained from your developer account */ private String appId; /* - * Provider Authentication Token, obtained through your developer account. Specify if using Token Authentication - * Mode. + * Gets or sets provider Authentication Token, obtained through your + * developer account */ private String token; @@ -71,7 +67,7 @@ public ApnsCredentialProperties() { } /** - * Get the apnsCertificate property: The APNS certificate. Specify if using Certificate Authentication Mode. + * Get the apnsCertificate property: Gets or sets the APNS certificate. * * @return the apnsCertificate value. */ @@ -80,7 +76,7 @@ public String apnsCertificate() { } /** - * Set the apnsCertificate property: The APNS certificate. Specify if using Certificate Authentication Mode. + * Set the apnsCertificate property: Gets or sets the APNS certificate. * * @param apnsCertificate the apnsCertificate value to set. * @return the ApnsCredentialProperties object itself. @@ -91,7 +87,7 @@ public ApnsCredentialProperties withApnsCertificate(String apnsCertificate) { } /** - * Get the certificateKey property: The APNS certificate password if it exists. + * Get the certificateKey property: Gets or sets the certificate key. * * @return the certificateKey value. */ @@ -100,7 +96,7 @@ public String certificateKey() { } /** - * Set the certificateKey property: The APNS certificate password if it exists. + * Set the certificateKey property: Gets or sets the certificate key. * * @param certificateKey the certificateKey value to set. * @return the ApnsCredentialProperties object itself. @@ -111,11 +107,7 @@ public ApnsCredentialProperties withCertificateKey(String certificateKey) { } /** - * Get the endpoint property: 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'. + * Get the endpoint property: Gets or sets the endpoint of this credential. * * @return the endpoint value. */ @@ -124,11 +116,7 @@ public String endpoint() { } /** - * Set the endpoint property: 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'. + * Set the endpoint property: Gets or sets the endpoint of this credential. * * @param endpoint the endpoint value to set. * @return the ApnsCredentialProperties object itself. @@ -139,7 +127,7 @@ public ApnsCredentialProperties withEndpoint(String endpoint) { } /** - * Get the thumbprint property: The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. + * Get the thumbprint property: Gets or sets the APNS certificate Thumbprint. * * @return the thumbprint value. */ @@ -148,7 +136,7 @@ public String thumbprint() { } /** - * Set the thumbprint property: The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. + * Set the thumbprint property: Gets or sets the APNS certificate Thumbprint. * * @param thumbprint the thumbprint value to set. * @return the ApnsCredentialProperties object itself. @@ -159,8 +147,8 @@ public ApnsCredentialProperties withThumbprint(String thumbprint) { } /** - * Get the keyId property: A 10-character key identifier (kid) key, obtained from your developer account. Specify if - * using Token Authentication Mode. + * Get the keyId property: Gets or sets a 10-character key identifier (kid) key, obtained from + * your developer account. * * @return the keyId value. */ @@ -169,8 +157,8 @@ public String keyId() { } /** - * Set the keyId property: A 10-character key identifier (kid) key, obtained from your developer account. Specify if - * using Token Authentication Mode. + * Set the keyId property: Gets or sets a 10-character key identifier (kid) key, obtained from + * your developer account. * * @param keyId the keyId value to set. * @return the ApnsCredentialProperties object itself. @@ -181,7 +169,7 @@ public ApnsCredentialProperties withKeyId(String keyId) { } /** - * Get the appName property: The name of the application or BundleId. Specify if using Token Authentication Mode. + * Get the appName property: Gets or sets the name of the application. * * @return the appName value. */ @@ -190,7 +178,7 @@ public String appName() { } /** - * Set the appName property: The name of the application or BundleId. Specify if using Token Authentication Mode. + * Set the appName property: Gets or sets the name of the application. * * @param appName the appName value to set. * @return the ApnsCredentialProperties object itself. @@ -201,8 +189,8 @@ public ApnsCredentialProperties withAppName(String appName) { } /** - * Get the appId property: The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from - * your developer account. Specify if using Token Authentication Mode. + * Get the appId property: Gets or sets the issuer (iss) registered claim key, whose value is + * your 10-character Team ID, obtained from your developer account. * * @return the appId value. */ @@ -211,8 +199,8 @@ public String appId() { } /** - * Set the appId property: The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from - * your developer account. Specify if using Token Authentication Mode. + * Set the appId property: Gets or sets the issuer (iss) registered claim key, whose value is + * your 10-character Team ID, obtained from your developer account. * * @param appId the appId value to set. * @return the ApnsCredentialProperties object itself. @@ -223,8 +211,8 @@ public ApnsCredentialProperties withAppId(String appId) { } /** - * Get the token property: Provider Authentication Token, obtained through your developer account. Specify if using - * Token Authentication Mode. + * Get the token property: Gets or sets provider Authentication Token, obtained through your + * developer account. * * @return the token value. */ @@ -233,8 +221,8 @@ public String token() { } /** - * Set the token property: Provider Authentication Token, obtained through your developer account. Specify if using - * Token Authentication Mode. + * Set the token property: Gets or sets provider Authentication Token, obtained through your + * developer account. * * @param token the token value to set. * @return the ApnsCredentialProperties object itself. @@ -250,17 +238,24 @@ public ApnsCredentialProperties withToken(String token) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (endpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property endpoint in model ApnsCredentialProperties")); + } } + private static final ClientLogger LOGGER = new ClientLogger(ApnsCredentialProperties.class); + /** * {@inheritDoc} */ @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endpoint", this.endpoint); jsonWriter.writeStringField("apnsCertificate", this.apnsCertificate); jsonWriter.writeStringField("certificateKey", this.certificateKey); - jsonWriter.writeStringField("endpoint", this.endpoint); jsonWriter.writeStringField("thumbprint", this.thumbprint); jsonWriter.writeStringField("keyId", this.keyId); jsonWriter.writeStringField("appName", this.appName); @@ -275,6 +270,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of ApnsCredentialProperties if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the ApnsCredentialProperties. */ public static ApnsCredentialProperties fromJson(JsonReader jsonReader) throws IOException { @@ -284,12 +280,12 @@ public static ApnsCredentialProperties fromJson(JsonReader jsonReader) throws IO String fieldName = reader.getFieldName(); reader.nextToken(); - if ("apnsCertificate".equals(fieldName)) { + if ("endpoint".equals(fieldName)) { + deserializedApnsCredentialProperties.endpoint = reader.getString(); + } else if ("apnsCertificate".equals(fieldName)) { deserializedApnsCredentialProperties.apnsCertificate = reader.getString(); } else if ("certificateKey".equals(fieldName)) { deserializedApnsCredentialProperties.certificateKey = reader.getString(); - } else if ("endpoint".equals(fieldName)) { - deserializedApnsCredentialProperties.endpoint = reader.getString(); } else if ("thumbprint".equals(fieldName)) { deserializedApnsCredentialProperties.thumbprint = reader.getString(); } else if ("keyId".equals(fieldName)) { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/BaiduCredentialProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/BaiduCredentialProperties.java index 8662b85a9c15..c321d8d50765 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/BaiduCredentialProperties.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/BaiduCredentialProperties.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,17 +18,17 @@ @Fluent public final class BaiduCredentialProperties implements JsonSerializable { /* - * Baidu Api Key. + * Gets or sets baidu Api Key. */ private String baiduApiKey; /* - * Baidu Endpoint. + * Gets or sets baidu Endpoint. */ private String baiduEndPoint; /* - * Baidu Secret Key + * Gets or sets baidu Secret Key */ private String baiduSecretKey; @@ -38,7 +39,7 @@ public BaiduCredentialProperties() { } /** - * Get the baiduApiKey property: Baidu Api Key. + * Get the baiduApiKey property: Gets or sets baidu Api Key. * * @return the baiduApiKey value. */ @@ -47,7 +48,7 @@ public String baiduApiKey() { } /** - * Set the baiduApiKey property: Baidu Api Key. + * Set the baiduApiKey property: Gets or sets baidu Api Key. * * @param baiduApiKey the baiduApiKey value to set. * @return the BaiduCredentialProperties object itself. @@ -58,7 +59,7 @@ public BaiduCredentialProperties withBaiduApiKey(String baiduApiKey) { } /** - * Get the baiduEndPoint property: Baidu Endpoint. + * Get the baiduEndPoint property: Gets or sets baidu Endpoint. * * @return the baiduEndPoint value. */ @@ -67,7 +68,7 @@ public String baiduEndPoint() { } /** - * Set the baiduEndPoint property: Baidu Endpoint. + * Set the baiduEndPoint property: Gets or sets baidu Endpoint. * * @param baiduEndPoint the baiduEndPoint value to set. * @return the BaiduCredentialProperties object itself. @@ -78,7 +79,7 @@ public BaiduCredentialProperties withBaiduEndPoint(String baiduEndPoint) { } /** - * Get the baiduSecretKey property: Baidu Secret Key. + * Get the baiduSecretKey property: Gets or sets baidu Secret Key. * * @return the baiduSecretKey value. */ @@ -87,7 +88,7 @@ public String baiduSecretKey() { } /** - * Set the baiduSecretKey property: Baidu Secret Key. + * Set the baiduSecretKey property: Gets or sets baidu Secret Key. * * @param baiduSecretKey the baiduSecretKey value to set. * @return the BaiduCredentialProperties object itself. @@ -103,8 +104,25 @@ public BaiduCredentialProperties withBaiduSecretKey(String baiduSecretKey) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (baiduApiKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property baiduApiKey in model BaiduCredentialProperties")); + } + if (baiduEndPoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property baiduEndPoint in model BaiduCredentialProperties")); + } + if (baiduSecretKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property baiduSecretKey in model BaiduCredentialProperties")); + } } + private static final ClientLogger LOGGER = new ClientLogger(BaiduCredentialProperties.class); + /** * {@inheritDoc} */ @@ -123,6 +141,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of BaiduCredentialProperties if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the BaiduCredentialProperties. */ public static BaiduCredentialProperties fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/BrowserCredentialProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/BrowserCredentialProperties.java new file mode 100644 index 000000000000..fe2440212f77 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/BrowserCredentialProperties.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Description of a NotificationHub BrowserCredential. + */ +@Fluent +public final class BrowserCredentialProperties implements JsonSerializable { + /* + * Gets or sets web push subject. + */ + private String subject; + + /* + * Gets or sets VAPID private key. + */ + private String vapidPrivateKey; + + /* + * Gets or sets VAPID public key. + */ + private String vapidPublicKey; + + /** + * Creates an instance of BrowserCredentialProperties class. + */ + public BrowserCredentialProperties() { + } + + /** + * Get the subject property: Gets or sets web push subject. + * + * @return the subject value. + */ + public String subject() { + return this.subject; + } + + /** + * Set the subject property: Gets or sets web push subject. + * + * @param subject the subject value to set. + * @return the BrowserCredentialProperties object itself. + */ + public BrowserCredentialProperties withSubject(String subject) { + this.subject = subject; + return this; + } + + /** + * Get the vapidPrivateKey property: Gets or sets VAPID private key. + * + * @return the vapidPrivateKey value. + */ + public String vapidPrivateKey() { + return this.vapidPrivateKey; + } + + /** + * Set the vapidPrivateKey property: Gets or sets VAPID private key. + * + * @param vapidPrivateKey the vapidPrivateKey value to set. + * @return the BrowserCredentialProperties object itself. + */ + public BrowserCredentialProperties withVapidPrivateKey(String vapidPrivateKey) { + this.vapidPrivateKey = vapidPrivateKey; + return this; + } + + /** + * Get the vapidPublicKey property: Gets or sets VAPID public key. + * + * @return the vapidPublicKey value. + */ + public String vapidPublicKey() { + return this.vapidPublicKey; + } + + /** + * Set the vapidPublicKey property: Gets or sets VAPID public key. + * + * @param vapidPublicKey the vapidPublicKey value to set. + * @return the BrowserCredentialProperties object itself. + */ + public BrowserCredentialProperties withVapidPublicKey(String vapidPublicKey) { + this.vapidPublicKey = vapidPublicKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subject() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property subject in model BrowserCredentialProperties")); + } + if (vapidPrivateKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property vapidPrivateKey in model BrowserCredentialProperties")); + } + if (vapidPublicKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property vapidPublicKey in model BrowserCredentialProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BrowserCredentialProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subject", this.subject); + jsonWriter.writeStringField("vapidPrivateKey", this.vapidPrivateKey); + jsonWriter.writeStringField("vapidPublicKey", this.vapidPublicKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BrowserCredentialProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BrowserCredentialProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BrowserCredentialProperties. + */ + public static BrowserCredentialProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BrowserCredentialProperties deserializedBrowserCredentialProperties = new BrowserCredentialProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subject".equals(fieldName)) { + deserializedBrowserCredentialProperties.subject = reader.getString(); + } else if ("vapidPrivateKey".equals(fieldName)) { + deserializedBrowserCredentialProperties.vapidPrivateKey = reader.getString(); + } else if ("vapidPublicKey".equals(fieldName)) { + deserializedBrowserCredentialProperties.vapidPublicKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBrowserCredentialProperties; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/CheckAvailabilityResultInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/CheckAvailabilityResultInner.java index 455fb6df6454..23458f6fc8db 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/CheckAvailabilityResultInner.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/CheckAvailabilityResultInner.java @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -16,18 +17,34 @@ /** * Description of a CheckAvailability resource. */ -@Fluent -public final class CheckAvailabilityResultInner extends Resource { +@Immutable +public final class CheckAvailabilityResultInner extends ProxyResource { /* - * 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. */ private Boolean isAvailiable; /* - * The sku of the created namespace + * Deprecated - only for compatibility. + */ + private String location; + + /* + * Deprecated - only for compatibility. + */ + private Map tags; + + /* + * The Sku description for a namespace */ private Sku sku; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -46,12 +63,12 @@ public final class CheckAvailabilityResultInner extends Resource { /** * Creates an instance of CheckAvailabilityResultInner class. */ - public CheckAvailabilityResultInner() { + private CheckAvailabilityResultInner() { } /** - * Get the isAvailiable property: True if the name is available and can be used to create new - * Namespace/NotificationHub. Otherwise false. + * Get the isAvailiable property: Gets or sets true if the name is available and can be used to + * create new Namespace/NotificationHub. Otherwise false. * * @return the isAvailiable value. */ @@ -60,19 +77,25 @@ public Boolean isAvailiable() { } /** - * Set the isAvailiable property: True if the name is available and can be used to create new - * Namespace/NotificationHub. Otherwise false. + * Get the location property: Deprecated - only for compatibility. * - * @param isAvailiable the isAvailiable value to set. - * @return the CheckAvailabilityResultInner object itself. + * @return the location value. */ - public CheckAvailabilityResultInner withIsAvailiable(Boolean isAvailiable) { - this.isAvailiable = isAvailiable; - return this; + public String location() { + return this.location; } /** - * Get the sku property: The sku of the created namespace. + * Get the tags property: Deprecated - only for compatibility. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Get the sku property: The Sku description for a namespace. * * @return the sku value. */ @@ -81,14 +104,12 @@ public Sku sku() { } /** - * Set the sku property: The sku of the created namespace. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param sku the sku value to set. - * @return the CheckAvailabilityResultInner object itself. + * @return the systemData value. */ - public CheckAvailabilityResultInner withSku(Sku sku) { - this.sku = sku; - return this; + public SystemData systemData() { + return this.systemData; } /** @@ -121,24 +142,6 @@ public String id() { return this.id; } - /** - * {@inheritDoc} - */ - @Override - public CheckAvailabilityResultInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public CheckAvailabilityResultInner withTags(Map tags) { - super.withTags(tags); - return this; - } - /** * Validates the instance. * @@ -156,9 +159,9 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); jsonWriter.writeBooleanField("isAvailiable", this.isAvailiable); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); jsonWriter.writeJsonField("sku", this.sku); return jsonWriter.writeEndObject(); } @@ -185,15 +188,17 @@ public static CheckAvailabilityResultInner fromJson(JsonReader jsonReader) throw deserializedCheckAvailabilityResultInner.name = reader.getString(); } else if ("type".equals(fieldName)) { deserializedCheckAvailabilityResultInner.type = reader.getString(); + } else if ("isAvailiable".equals(fieldName)) { + deserializedCheckAvailabilityResultInner.isAvailiable = reader.getNullable(JsonReader::getBoolean); } else if ("location".equals(fieldName)) { - deserializedCheckAvailabilityResultInner.withLocation(reader.getString()); + deserializedCheckAvailabilityResultInner.location = reader.getString(); } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedCheckAvailabilityResultInner.withTags(tags); - } else if ("isAvailiable".equals(fieldName)) { - deserializedCheckAvailabilityResultInner.isAvailiable = reader.getNullable(JsonReader::getBoolean); + deserializedCheckAvailabilityResultInner.tags = tags; } else if ("sku".equals(fieldName)) { deserializedCheckAvailabilityResultInner.sku = Sku.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCheckAvailabilityResultInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/DebugSendResponseInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/DebugSendResponseInner.java index 60b5d5479f47..d9788c956aa1 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/DebugSendResponseInner.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/DebugSendResponseInner.java @@ -1,32 +1,44 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; -import com.azure.resourcemanager.notificationhubs.models.Sku; +import com.azure.resourcemanager.notificationhubs.models.RegistrationResult; import java.io.IOException; +import java.util.List; import java.util.Map; /** * Description of a NotificationHub Resource. */ -@Fluent -public final class DebugSendResponseInner extends Resource { +@Immutable +public final class DebugSendResponseInner extends ProxyResource { /* - * Properties of the NotificationHub. + * Result of DebugSend operations. */ private DebugSendResult innerProperties; /* - * The sku of the created namespace + * Deprecated - only for compatibility. */ - private Sku sku; + private String location; + + /* + * Deprecated - only for compatibility. + */ + private Map tags; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; /* * The type of the resource. @@ -46,11 +58,11 @@ public final class DebugSendResponseInner extends Resource { /** * Creates an instance of DebugSendResponseInner class. */ - public DebugSendResponseInner() { + private DebugSendResponseInner() { } /** - * Get the innerProperties property: Properties of the NotificationHub. + * Get the innerProperties property: Result of DebugSend operations. * * @return the innerProperties value. */ @@ -59,23 +71,30 @@ private DebugSendResult innerProperties() { } /** - * Get the sku property: The sku of the created namespace. + * Get the location property: Deprecated - only for compatibility. * - * @return the sku value. + * @return the location value. */ - public Sku sku() { - return this.sku; + public String location() { + return this.location; } /** - * Set the sku property: The sku of the created namespace. + * Get the tags property: Deprecated - only for compatibility. * - * @param sku the sku value to set. - * @return the DebugSendResponseInner object itself. + * @return the tags value. */ - public DebugSendResponseInner withSku(Sku sku) { - this.sku = sku; - return this; + public Map tags() { + return this.tags; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; } /** @@ -109,92 +128,32 @@ public String id() { } /** - * {@inheritDoc} - */ - @Override - public DebugSendResponseInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public DebugSendResponseInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the success property: successful send. + * Get the success property: Gets or sets successful send. * * @return the success value. */ - public Float success() { + public Long success() { return this.innerProperties() == null ? null : this.innerProperties().success(); } /** - * Set the success property: successful send. - * - * @param success the success value to set. - * @return the DebugSendResponseInner object itself. - */ - public DebugSendResponseInner withSuccess(Float success) { - if (this.innerProperties() == null) { - this.innerProperties = new DebugSendResult(); - } - this.innerProperties().withSuccess(success); - return this; - } - - /** - * Get the failure property: send failure. + * Get the failure property: Gets or sets send failure. * * @return the failure value. */ - public Float failure() { + public Long failure() { return this.innerProperties() == null ? null : this.innerProperties().failure(); } /** - * Set the failure property: send failure. - * - * @param failure the failure value to set. - * @return the DebugSendResponseInner object itself. - */ - public DebugSendResponseInner withFailure(Float failure) { - if (this.innerProperties() == null) { - this.innerProperties = new DebugSendResult(); - } - this.innerProperties().withFailure(failure); - return this; - } - - /** - * Get the results property: actual failure description. + * Get the results property: Gets or sets actual failure description. * * @return the results value. */ - public Object results() { + public List results() { return this.innerProperties() == null ? null : this.innerProperties().results(); } - /** - * Set the results property: actual failure description. - * - * @param results the results value to set. - * @return the DebugSendResponseInner object itself. - */ - public DebugSendResponseInner withResults(Object results) { - if (this.innerProperties() == null) { - this.innerProperties = new DebugSendResult(); - } - this.innerProperties().withResults(results); - return this; - } - /** * Validates the instance. * @@ -204,9 +163,6 @@ public void validate() { if (innerProperties() != null) { innerProperties().validate(); } - if (sku() != null) { - sku().validate(); - } } /** @@ -215,10 +171,9 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); return jsonWriter.writeEndObject(); } @@ -244,15 +199,15 @@ public static DebugSendResponseInner fromJson(JsonReader jsonReader) throws IOEx deserializedDebugSendResponseInner.name = reader.getString(); } else if ("type".equals(fieldName)) { deserializedDebugSendResponseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDebugSendResponseInner.innerProperties = DebugSendResult.fromJson(reader); } else if ("location".equals(fieldName)) { - deserializedDebugSendResponseInner.withLocation(reader.getString()); + deserializedDebugSendResponseInner.location = reader.getString(); } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedDebugSendResponseInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedDebugSendResponseInner.innerProperties = DebugSendResult.fromJson(reader); - } else if ("sku".equals(fieldName)) { - deserializedDebugSendResponseInner.sku = Sku.fromJson(reader); + deserializedDebugSendResponseInner.tags = tags; + } else if ("systemData".equals(fieldName)) { + deserializedDebugSendResponseInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/DebugSendResult.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/DebugSendResult.java index ff7f09f1605f..3a96fb1ea97f 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/DebugSendResult.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/DebugSendResult.java @@ -1,108 +1,80 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.models.RegistrationResult; import java.io.IOException; +import java.util.List; /** - * The DebugSendResult model. + * Result of DebugSend operations. */ -@Fluent +@Immutable public final class DebugSendResult implements JsonSerializable { /* - * successful send + * Gets or sets successful send */ - private Float success; + private Long success; /* - * send failure + * Gets or sets send failure */ - private Float failure; + private Long failure; /* - * actual failure description + * Gets or sets actual failure description */ - private Object results; + private List results; /** * Creates an instance of DebugSendResult class. */ - public DebugSendResult() { + private DebugSendResult() { } /** - * Get the success property: successful send. + * Get the success property: Gets or sets successful send. * * @return the success value. */ - public Float success() { + public Long success() { return this.success; } /** - * Set the success property: successful send. - * - * @param success the success value to set. - * @return the DebugSendResult object itself. - */ - public DebugSendResult withSuccess(Float success) { - this.success = success; - return this; - } - - /** - * Get the failure property: send failure. + * Get the failure property: Gets or sets send failure. * * @return the failure value. */ - public Float failure() { + public Long failure() { return this.failure; } /** - * Set the failure property: send failure. - * - * @param failure the failure value to set. - * @return the DebugSendResult object itself. - */ - public DebugSendResult withFailure(Float failure) { - this.failure = failure; - return this; - } - - /** - * Get the results property: actual failure description. + * Get the results property: Gets or sets actual failure description. * * @return the results value. */ - public Object results() { + public List results() { return this.results; } - /** - * Set the results property: actual failure description. - * - * @param results the results value to set. - * @return the DebugSendResult object itself. - */ - public DebugSendResult withResults(Object results) { - this.results = results; - return this; - } - /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (results() != null) { + results().forEach(e -> e.validate()); + } } /** @@ -111,9 +83,6 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("success", this.success); - jsonWriter.writeNumberField("failure", this.failure); - jsonWriter.writeUntypedField("results", this.results); return jsonWriter.writeEndObject(); } @@ -133,11 +102,13 @@ public static DebugSendResult fromJson(JsonReader jsonReader) throws IOException reader.nextToken(); if ("success".equals(fieldName)) { - deserializedDebugSendResult.success = reader.getNullable(JsonReader::getFloat); + deserializedDebugSendResult.success = reader.getNullable(JsonReader::getLong); } else if ("failure".equals(fieldName)) { - deserializedDebugSendResult.failure = reader.getNullable(JsonReader::getFloat); + deserializedDebugSendResult.failure = reader.getNullable(JsonReader::getLong); } else if ("results".equals(fieldName)) { - deserializedDebugSendResult.results = reader.readUntyped(); + List results + = reader.readArray(reader1 -> RegistrationResult.fromJson(reader1)); + deserializedDebugSendResult.results = results; } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/FcmV1CredentialProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/FcmV1CredentialProperties.java new file mode 100644 index 000000000000..172f7112eda4 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/FcmV1CredentialProperties.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Description of a NotificationHub FcmV1Credential. + */ +@Fluent +public final class FcmV1CredentialProperties implements JsonSerializable { + /* + * Gets or sets client email. + */ + private String clientEmail; + + /* + * Gets or sets private key. + */ + private String privateKey; + + /* + * Gets or sets project id. + */ + private String projectId; + + /** + * Creates an instance of FcmV1CredentialProperties class. + */ + public FcmV1CredentialProperties() { + } + + /** + * Get the clientEmail property: Gets or sets client email. + * + * @return the clientEmail value. + */ + public String clientEmail() { + return this.clientEmail; + } + + /** + * Set the clientEmail property: Gets or sets client email. + * + * @param clientEmail the clientEmail value to set. + * @return the FcmV1CredentialProperties object itself. + */ + public FcmV1CredentialProperties withClientEmail(String clientEmail) { + this.clientEmail = clientEmail; + return this; + } + + /** + * Get the privateKey property: Gets or sets private key. + * + * @return the privateKey value. + */ + public String privateKey() { + return this.privateKey; + } + + /** + * Set the privateKey property: Gets or sets private key. + * + * @param privateKey the privateKey value to set. + * @return the FcmV1CredentialProperties object itself. + */ + public FcmV1CredentialProperties withPrivateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * Get the projectId property: Gets or sets project id. + * + * @return the projectId value. + */ + public String projectId() { + return this.projectId; + } + + /** + * Set the projectId property: Gets or sets project id. + * + * @param projectId the projectId value to set. + * @return the FcmV1CredentialProperties object itself. + */ + public FcmV1CredentialProperties withProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (clientEmail() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property clientEmail in model FcmV1CredentialProperties")); + } + if (privateKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privateKey in model FcmV1CredentialProperties")); + } + if (projectId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property projectId in model FcmV1CredentialProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FcmV1CredentialProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("clientEmail", this.clientEmail); + jsonWriter.writeStringField("privateKey", this.privateKey); + jsonWriter.writeStringField("projectId", this.projectId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FcmV1CredentialProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FcmV1CredentialProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FcmV1CredentialProperties. + */ + public static FcmV1CredentialProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FcmV1CredentialProperties deserializedFcmV1CredentialProperties = new FcmV1CredentialProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clientEmail".equals(fieldName)) { + deserializedFcmV1CredentialProperties.clientEmail = reader.getString(); + } else if ("privateKey".equals(fieldName)) { + deserializedFcmV1CredentialProperties.privateKey = reader.getString(); + } else if ("projectId".equals(fieldName)) { + deserializedFcmV1CredentialProperties.projectId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFcmV1CredentialProperties; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/GcmCredentialProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/GcmCredentialProperties.java index fc3cd7e180e4..110ab51fbd77 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/GcmCredentialProperties.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/GcmCredentialProperties.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,12 +18,12 @@ @Fluent public final class GcmCredentialProperties implements JsonSerializable { /* - * The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send' + * Gets or sets the GCM endpoint. */ private String gcmEndpoint; /* - * The Google API key. + * Gets or sets the Google API key. */ private String googleApiKey; @@ -33,7 +34,7 @@ public GcmCredentialProperties() { } /** - * Get the gcmEndpoint property: The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send'. + * Get the gcmEndpoint property: Gets or sets the GCM endpoint. * * @return the gcmEndpoint value. */ @@ -42,7 +43,7 @@ public String gcmEndpoint() { } /** - * Set the gcmEndpoint property: The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send'. + * Set the gcmEndpoint property: Gets or sets the GCM endpoint. * * @param gcmEndpoint the gcmEndpoint value to set. * @return the GcmCredentialProperties object itself. @@ -53,7 +54,7 @@ public GcmCredentialProperties withGcmEndpoint(String gcmEndpoint) { } /** - * Get the googleApiKey property: The Google API key. + * Get the googleApiKey property: Gets or sets the Google API key. * * @return the googleApiKey value. */ @@ -62,7 +63,7 @@ public String googleApiKey() { } /** - * Set the googleApiKey property: The Google API key. + * Set the googleApiKey property: Gets or sets the Google API key. * * @param googleApiKey the googleApiKey value to set. * @return the GcmCredentialProperties object itself. @@ -78,16 +79,23 @@ public GcmCredentialProperties withGoogleApiKey(String googleApiKey) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (googleApiKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property googleApiKey in model GcmCredentialProperties")); + } } + private static final ClientLogger LOGGER = new ClientLogger(GcmCredentialProperties.class); + /** * {@inheritDoc} */ @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("gcmEndpoint", this.gcmEndpoint); jsonWriter.writeStringField("googleApiKey", this.googleApiKey); + jsonWriter.writeStringField("gcmEndpoint", this.gcmEndpoint); return jsonWriter.writeEndObject(); } @@ -97,6 +105,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of GcmCredentialProperties if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the GcmCredentialProperties. */ public static GcmCredentialProperties fromJson(JsonReader jsonReader) throws IOException { @@ -106,10 +115,10 @@ public static GcmCredentialProperties fromJson(JsonReader jsonReader) throws IOE String fieldName = reader.getFieldName(); reader.nextToken(); - if ("gcmEndpoint".equals(fieldName)) { - deserializedGcmCredentialProperties.gcmEndpoint = reader.getString(); - } else if ("googleApiKey".equals(fieldName)) { + if ("googleApiKey".equals(fieldName)) { deserializedGcmCredentialProperties.googleApiKey = reader.getString(); + } else if ("gcmEndpoint".equals(fieldName)) { + deserializedGcmCredentialProperties.gcmEndpoint = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/MpnsCredentialProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/MpnsCredentialProperties.java index 5ecb3b227af7..3eca325acb17 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/MpnsCredentialProperties.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/MpnsCredentialProperties.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,17 +18,17 @@ @Fluent public final class MpnsCredentialProperties implements JsonSerializable { /* - * The MPNS certificate. + * Gets or sets the MPNS certificate. */ private String mpnsCertificate; /* - * The certificate key for this credential. + * Gets or sets the certificate key for this credential. */ private String certificateKey; /* - * The MPNS certificate Thumbprint + * Gets or sets the MPNS certificate Thumbprint */ private String thumbprint; @@ -38,7 +39,7 @@ public MpnsCredentialProperties() { } /** - * Get the mpnsCertificate property: The MPNS certificate. + * Get the mpnsCertificate property: Gets or sets the MPNS certificate. * * @return the mpnsCertificate value. */ @@ -47,7 +48,7 @@ public String mpnsCertificate() { } /** - * Set the mpnsCertificate property: The MPNS certificate. + * Set the mpnsCertificate property: Gets or sets the MPNS certificate. * * @param mpnsCertificate the mpnsCertificate value to set. * @return the MpnsCredentialProperties object itself. @@ -58,7 +59,7 @@ public MpnsCredentialProperties withMpnsCertificate(String mpnsCertificate) { } /** - * Get the certificateKey property: The certificate key for this credential. + * Get the certificateKey property: Gets or sets the certificate key for this credential. * * @return the certificateKey value. */ @@ -67,7 +68,7 @@ public String certificateKey() { } /** - * Set the certificateKey property: The certificate key for this credential. + * Set the certificateKey property: Gets or sets the certificate key for this credential. * * @param certificateKey the certificateKey value to set. * @return the MpnsCredentialProperties object itself. @@ -78,7 +79,7 @@ public MpnsCredentialProperties withCertificateKey(String certificateKey) { } /** - * Get the thumbprint property: The MPNS certificate Thumbprint. + * Get the thumbprint property: Gets or sets the MPNS certificate Thumbprint. * * @return the thumbprint value. */ @@ -87,7 +88,7 @@ public String thumbprint() { } /** - * Set the thumbprint property: The MPNS certificate Thumbprint. + * Set the thumbprint property: Gets or sets the MPNS certificate Thumbprint. * * @param thumbprint the thumbprint value to set. * @return the MpnsCredentialProperties object itself. @@ -103,8 +104,25 @@ public MpnsCredentialProperties withThumbprint(String thumbprint) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (mpnsCertificate() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property mpnsCertificate in model MpnsCredentialProperties")); + } + if (certificateKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property certificateKey in model MpnsCredentialProperties")); + } + if (thumbprint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property thumbprint in model MpnsCredentialProperties")); + } } + private static final ClientLogger LOGGER = new ClientLogger(MpnsCredentialProperties.class); + /** * {@inheritDoc} */ @@ -123,6 +141,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of MpnsCredentialProperties if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the MpnsCredentialProperties. */ public static MpnsCredentialProperties fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NamespaceProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NamespaceProperties.java index fb9dc20713d0..a487174e4979 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NamespaceProperties.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NamespaceProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; @@ -10,87 +10,124 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.models.NamespaceStatus; import com.azure.resourcemanager.notificationhubs.models.NamespaceType; +import com.azure.resourcemanager.notificationhubs.models.NetworkAcls; +import com.azure.resourcemanager.notificationhubs.models.OperationProvisioningState; +import com.azure.resourcemanager.notificationhubs.models.PublicNetworkAccess; +import com.azure.resourcemanager.notificationhubs.models.ReplicationRegion; +import com.azure.resourcemanager.notificationhubs.models.ZoneRedundancyPreference; import java.io.IOException; import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; +import java.util.List; /** - * Namespace properties. + * Represents namespace properties. */ @Fluent public final class NamespaceProperties implements JsonSerializable { /* - * The name of the namespace. + * Name of the Notification Hubs namespace. This is immutable property, set automatically + * by the service when the namespace is created. */ private String name; /* - * Provisioning state of the Namespace. + * Defines values for OperationProvisioningState. */ - private String provisioningState; + private OperationProvisioningState provisioningState; /* - * 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 + * Namespace status. */ - private String region; + private NamespaceStatus status; /* - * Identifier for Azure Insights metrics + * Gets or sets whether or not the namespace is currently enabled. */ - private String metricId; + private Boolean enabled; + + /* + * Gets or sets whether or not the namespace is set as Critical. + */ + private Boolean critical; + + /* + * Namespace subscription id. + */ + private String subscriptionId; + + /* + * Region. The value is always set to the same value as Namespace.Location, so we are deprecating + * this property. + */ + private String region; /* - * Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting + * Azure Insights Metrics id. */ - private String status; + private String metricId; /* - * The time the namespace was created. + * Time when the namespace was created. */ private OffsetDateTime createdAt; /* - * The time the namespace was updated. + * Time when the namespace was updated. */ private OffsetDateTime updatedAt; /* - * Endpoint you can use to perform NotificationHub operations. + * Defines values for NamespaceType. */ - private String serviceBusEndpoint; + private NamespaceType namespaceType; /* - * The Id of the Azure subscription associated with the namespace. + * Allowed replication region */ - private String subscriptionId; + private ReplicationRegion replicationRegion; /* - * ScaleUnit where the namespace gets created + * Namespace SKU name. */ - private String scaleUnit; + private ZoneRedundancyPreference zoneRedundancy; /* - * Whether or not the namespace is currently enabled. + * A collection of network authorization rules. */ - private Boolean enabled; + private NetworkAcls networkAcls; /* - * Whether or not the namespace is set as Critical. + * Collection of Notification Hub or Notification Hub Namespace PNS credentials. */ - private Boolean critical; + private PnsCredentials pnsCredentials; + + /* + * Gets or sets endpoint you can use to perform NotificationHub + * operations. + */ + private String serviceBusEndpoint; + + /* + * Private Endpoint Connections for namespace + */ + private List privateEndpointConnections; + + /* + * Gets or sets scaleUnit where the namespace gets created + */ + private String scaleUnit; /* - * Data center for the namespace + * Deprecated. */ private String dataCenter; /* - * The namespace type. + * Type of public network access. */ - private NamespaceType namespaceType; + private PublicNetworkAccess publicNetworkAccess; /** * Creates an instance of NamespaceProperties class. @@ -99,7 +136,8 @@ public NamespaceProperties() { } /** - * Get the name property: The name of the namespace. + * Get the name property: Name of the Notification Hubs namespace. This is immutable property, set automatically + * by the service when the namespace is created. * * @return the name value. */ @@ -108,93 +146,94 @@ public String name() { } /** - * Set the name property: The name of the namespace. + * Get the provisioningState property: Defines values for OperationProvisioningState. * - * @param name the name value to set. + * @return the provisioningState value. + */ + public OperationProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Defines values for OperationProvisioningState. + * + * @param provisioningState the provisioningState value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties withName(String name) { - this.name = name; + public NamespaceProperties withProvisioningState(OperationProvisioningState provisioningState) { + this.provisioningState = provisioningState; return this; } /** - * Get the provisioningState property: Provisioning state of the Namespace. + * Get the status property: Namespace status. * - * @return the provisioningState value. + * @return the status value. */ - public String provisioningState() { - return this.provisioningState; + public NamespaceStatus status() { + return this.status; } /** - * Set the provisioningState property: Provisioning state of the Namespace. + * Set the status property: Namespace status. * - * @param provisioningState the provisioningState value to set. + * @param status the status value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties withProvisioningState(String provisioningState) { - this.provisioningState = provisioningState; + public NamespaceProperties withStatus(NamespaceStatus status) { + this.status = status; return this; } /** - * Get the region property: 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. + * Get the enabled property: Gets or sets whether or not the namespace is currently enabled. * - * @return the region value. + * @return the enabled value. */ - public String region() { - return this.region; + public Boolean enabled() { + return this.enabled; } /** - * Set the region property: 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. + * Get the critical property: Gets or sets whether or not the namespace is set as Critical. * - * @param region the region value to set. - * @return the NamespaceProperties object itself. + * @return the critical value. */ - public NamespaceProperties withRegion(String region) { - this.region = region; - return this; + public Boolean critical() { + return this.critical; } /** - * Get the metricId property: Identifier for Azure Insights metrics. + * Get the subscriptionId property: Namespace subscription id. * - * @return the metricId value. + * @return the subscriptionId value. */ - public String metricId() { - return this.metricId; + public String subscriptionId() { + return this.subscriptionId; } /** - * Get the status property: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = - * Suspended4 = Deleting. + * Get the region property: Region. The value is always set to the same value as Namespace.Location, so we are + * deprecating + * this property. * - * @return the status value. + * @return the region value. */ - public String status() { - return this.status; + public String region() { + return this.region; } /** - * Set the status property: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = - * Suspended4 = Deleting. + * Get the metricId property: Azure Insights Metrics id. * - * @param status the status value to set. - * @return the NamespaceProperties object itself. + * @return the metricId value. */ - public NamespaceProperties withStatus(String status) { - this.status = status; - return this; + public String metricId() { + return this.metricId; } /** - * Get the createdAt property: The time the namespace was created. + * Get the createdAt property: Time when the namespace was created. * * @return the createdAt value. */ @@ -203,138 +242,155 @@ public OffsetDateTime createdAt() { } /** - * Set the createdAt property: The time the namespace was created. + * Get the updatedAt property: Time when the namespace was updated. * - * @param createdAt the createdAt value to set. - * @return the NamespaceProperties object itself. + * @return the updatedAt value. */ - public NamespaceProperties withCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; + public OffsetDateTime updatedAt() { + return this.updatedAt; } /** - * Get the updatedAt property: The time the namespace was updated. + * Get the namespaceType property: Defines values for NamespaceType. * - * @return the updatedAt value. + * @return the namespaceType value. */ - public OffsetDateTime updatedAt() { - return this.updatedAt; + public NamespaceType namespaceType() { + return this.namespaceType; } /** - * Set the updatedAt property: The time the namespace was updated. + * Set the namespaceType property: Defines values for NamespaceType. * - * @param updatedAt the updatedAt value to set. + * @param namespaceType the namespaceType value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties withUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; + public NamespaceProperties withNamespaceType(NamespaceType namespaceType) { + this.namespaceType = namespaceType; return this; } /** - * Get the serviceBusEndpoint property: Endpoint you can use to perform NotificationHub operations. + * Get the replicationRegion property: Allowed replication region. * - * @return the serviceBusEndpoint value. + * @return the replicationRegion value. */ - public String serviceBusEndpoint() { - return this.serviceBusEndpoint; + public ReplicationRegion replicationRegion() { + return this.replicationRegion; } /** - * Set the serviceBusEndpoint property: Endpoint you can use to perform NotificationHub operations. + * Set the replicationRegion property: Allowed replication region. * - * @param serviceBusEndpoint the serviceBusEndpoint value to set. + * @param replicationRegion the replicationRegion value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties withServiceBusEndpoint(String serviceBusEndpoint) { - this.serviceBusEndpoint = serviceBusEndpoint; + public NamespaceProperties withReplicationRegion(ReplicationRegion replicationRegion) { + this.replicationRegion = replicationRegion; return this; } /** - * Get the subscriptionId property: The Id of the Azure subscription associated with the namespace. + * Get the zoneRedundancy property: Namespace SKU name. * - * @return the subscriptionId value. + * @return the zoneRedundancy value. */ - public String subscriptionId() { - return this.subscriptionId; + public ZoneRedundancyPreference zoneRedundancy() { + return this.zoneRedundancy; } /** - * Set the subscriptionId property: The Id of the Azure subscription associated with the namespace. + * Set the zoneRedundancy property: Namespace SKU name. * - * @param subscriptionId the subscriptionId value to set. + * @param zoneRedundancy the zoneRedundancy value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties withSubscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; + public NamespaceProperties withZoneRedundancy(ZoneRedundancyPreference zoneRedundancy) { + this.zoneRedundancy = zoneRedundancy; return this; } /** - * Get the scaleUnit property: ScaleUnit where the namespace gets created. + * Get the networkAcls property: A collection of network authorization rules. * - * @return the scaleUnit value. + * @return the networkAcls value. */ - public String scaleUnit() { - return this.scaleUnit; + public NetworkAcls networkAcls() { + return this.networkAcls; } /** - * Set the scaleUnit property: ScaleUnit where the namespace gets created. + * Set the networkAcls property: A collection of network authorization rules. * - * @param scaleUnit the scaleUnit value to set. + * @param networkAcls the networkAcls value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties withScaleUnit(String scaleUnit) { - this.scaleUnit = scaleUnit; + public NamespaceProperties withNetworkAcls(NetworkAcls networkAcls) { + this.networkAcls = networkAcls; return this; } /** - * Get the enabled property: Whether or not the namespace is currently enabled. + * Get the pnsCredentials property: Collection of Notification Hub or Notification Hub Namespace PNS credentials. * - * @return the enabled value. + * @return the pnsCredentials value. */ - public Boolean enabled() { - return this.enabled; + public PnsCredentials pnsCredentials() { + return this.pnsCredentials; } /** - * Set the enabled property: Whether or not the namespace is currently enabled. + * Set the pnsCredentials property: Collection of Notification Hub or Notification Hub Namespace PNS credentials. * - * @param enabled the enabled value to set. + * @param pnsCredentials the pnsCredentials value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties withEnabled(Boolean enabled) { - this.enabled = enabled; + public NamespaceProperties withPnsCredentials(PnsCredentials pnsCredentials) { + this.pnsCredentials = pnsCredentials; return this; } /** - * Get the critical property: Whether or not the namespace is set as Critical. + * Get the serviceBusEndpoint property: Gets or sets endpoint you can use to perform NotificationHub + * operations. * - * @return the critical value. + * @return the serviceBusEndpoint value. */ - public Boolean critical() { - return this.critical; + public String serviceBusEndpoint() { + return this.serviceBusEndpoint; + } + + /** + * Get the privateEndpointConnections property: Private Endpoint Connections for namespace. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the scaleUnit property: Gets or sets scaleUnit where the namespace gets created. + * + * @return the scaleUnit value. + */ + public String scaleUnit() { + return this.scaleUnit; } /** - * Set the critical property: Whether or not the namespace is set as Critical. + * Set the scaleUnit property: Gets or sets scaleUnit where the namespace gets created. * - * @param critical the critical value to set. + * @param scaleUnit the scaleUnit value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties withCritical(Boolean critical) { - this.critical = critical; + public NamespaceProperties withScaleUnit(String scaleUnit) { + this.scaleUnit = scaleUnit; return this; } /** - * Get the dataCenter property: Data center for the namespace. + * Get the dataCenter property: Deprecated. * * @return the dataCenter value. */ @@ -343,7 +399,7 @@ public String dataCenter() { } /** - * Set the dataCenter property: Data center for the namespace. + * Set the dataCenter property: Deprecated. * * @param dataCenter the dataCenter value to set. * @return the NamespaceProperties object itself. @@ -354,22 +410,22 @@ public NamespaceProperties withDataCenter(String dataCenter) { } /** - * Get the namespaceType property: The namespace type. + * Get the publicNetworkAccess property: Type of public network access. * - * @return the namespaceType value. + * @return the publicNetworkAccess value. */ - public NamespaceType namespaceType() { - return this.namespaceType; + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; } /** - * Set the namespaceType property: The namespace type. + * Set the publicNetworkAccess property: Type of public network access. * - * @param namespaceType the namespaceType value to set. + * @param publicNetworkAccess the publicNetworkAccess value to set. * @return the NamespaceProperties object itself. */ - public NamespaceProperties withNamespaceType(NamespaceType namespaceType) { - this.namespaceType = namespaceType; + public NamespaceProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; return this; } @@ -379,6 +435,15 @@ public NamespaceProperties withNamespaceType(NamespaceType namespaceType) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (networkAcls() != null) { + networkAcls().validate(); + } + if (pnsCredentials() != null) { + pnsCredentials().validate(); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } } /** @@ -387,21 +452,20 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("provisioningState", this.provisioningState); - jsonWriter.writeStringField("region", this.region); - jsonWriter.writeStringField("status", this.status); - jsonWriter.writeStringField("createdAt", - this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); - jsonWriter.writeStringField("updatedAt", - this.updatedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.updatedAt)); - jsonWriter.writeStringField("serviceBusEndpoint", this.serviceBusEndpoint); - jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("namespaceType", this.namespaceType == null ? null : this.namespaceType.toString()); + jsonWriter.writeStringField("replicationRegion", + this.replicationRegion == null ? null : this.replicationRegion.toString()); + jsonWriter.writeStringField("zoneRedundancy", + this.zoneRedundancy == null ? null : this.zoneRedundancy.toString()); + jsonWriter.writeJsonField("networkAcls", this.networkAcls); + jsonWriter.writeJsonField("pnsCredentials", this.pnsCredentials); jsonWriter.writeStringField("scaleUnit", this.scaleUnit); - jsonWriter.writeBooleanField("enabled", this.enabled); - jsonWriter.writeBooleanField("critical", this.critical); jsonWriter.writeStringField("dataCenter", this.dataCenter); - jsonWriter.writeStringField("namespaceType", this.namespaceType == null ? null : this.namespaceType.toString()); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); return jsonWriter.writeEndObject(); } @@ -423,33 +487,51 @@ public static NamespaceProperties fromJson(JsonReader jsonReader) throws IOExcep if ("name".equals(fieldName)) { deserializedNamespaceProperties.name = reader.getString(); } else if ("provisioningState".equals(fieldName)) { - deserializedNamespaceProperties.provisioningState = reader.getString(); + deserializedNamespaceProperties.provisioningState + = OperationProvisioningState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedNamespaceProperties.status = NamespaceStatus.fromString(reader.getString()); + } else if ("enabled".equals(fieldName)) { + deserializedNamespaceProperties.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("critical".equals(fieldName)) { + deserializedNamespaceProperties.critical = reader.getNullable(JsonReader::getBoolean); + } else if ("subscriptionId".equals(fieldName)) { + deserializedNamespaceProperties.subscriptionId = reader.getString(); } else if ("region".equals(fieldName)) { deserializedNamespaceProperties.region = reader.getString(); } else if ("metricId".equals(fieldName)) { deserializedNamespaceProperties.metricId = reader.getString(); - } else if ("status".equals(fieldName)) { - deserializedNamespaceProperties.status = reader.getString(); } else if ("createdAt".equals(fieldName)) { deserializedNamespaceProperties.createdAt = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("updatedAt".equals(fieldName)) { deserializedNamespaceProperties.updatedAt = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("namespaceType".equals(fieldName)) { + deserializedNamespaceProperties.namespaceType = NamespaceType.fromString(reader.getString()); + } else if ("replicationRegion".equals(fieldName)) { + deserializedNamespaceProperties.replicationRegion + = ReplicationRegion.fromString(reader.getString()); + } else if ("zoneRedundancy".equals(fieldName)) { + deserializedNamespaceProperties.zoneRedundancy + = ZoneRedundancyPreference.fromString(reader.getString()); + } else if ("networkAcls".equals(fieldName)) { + deserializedNamespaceProperties.networkAcls = NetworkAcls.fromJson(reader); + } else if ("pnsCredentials".equals(fieldName)) { + deserializedNamespaceProperties.pnsCredentials = PnsCredentials.fromJson(reader); } else if ("serviceBusEndpoint".equals(fieldName)) { deserializedNamespaceProperties.serviceBusEndpoint = reader.getString(); - } else if ("subscriptionId".equals(fieldName)) { - deserializedNamespaceProperties.subscriptionId = reader.getString(); + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> PrivateEndpointConnectionResourceInner.fromJson(reader1)); + deserializedNamespaceProperties.privateEndpointConnections = privateEndpointConnections; } else if ("scaleUnit".equals(fieldName)) { deserializedNamespaceProperties.scaleUnit = reader.getString(); - } else if ("enabled".equals(fieldName)) { - deserializedNamespaceProperties.enabled = reader.getNullable(JsonReader::getBoolean); - } else if ("critical".equals(fieldName)) { - deserializedNamespaceProperties.critical = reader.getNullable(JsonReader::getBoolean); } else if ("dataCenter".equals(fieldName)) { deserializedNamespaceProperties.dataCenter = reader.getString(); - } else if ("namespaceType".equals(fieldName)) { - deserializedNamespaceProperties.namespaceType = NamespaceType.fromString(reader.getString()); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedNamespaceProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NamespaceResourceInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NamespaceResourceInner.java index fc21add04bea..173ca25088e7 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NamespaceResourceInner.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NamespaceResourceInner.java @@ -1,34 +1,48 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.models.NamespaceStatus; import com.azure.resourcemanager.notificationhubs.models.NamespaceType; +import com.azure.resourcemanager.notificationhubs.models.NetworkAcls; +import com.azure.resourcemanager.notificationhubs.models.OperationProvisioningState; +import com.azure.resourcemanager.notificationhubs.models.PublicNetworkAccess; +import com.azure.resourcemanager.notificationhubs.models.ReplicationRegion; import com.azure.resourcemanager.notificationhubs.models.Sku; +import com.azure.resourcemanager.notificationhubs.models.ZoneRedundancyPreference; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.List; import java.util.Map; /** - * Description of a Namespace resource. + * Notification Hubs Namespace Resource. */ @Fluent public final class NamespaceResourceInner extends Resource { /* - * Properties of the Namespace. + * The Sku description for a namespace + */ + private Sku sku; + + /* + * Represents namespace properties. */ private NamespaceProperties innerProperties; /* - * The sku of the created namespace + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - private Sku sku; + private SystemData systemData; /* * The type of the resource. @@ -52,16 +66,7 @@ public NamespaceResourceInner() { } /** - * Get the innerProperties property: Properties of the Namespace. - * - * @return the innerProperties value. - */ - private NamespaceProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the sku property: The sku of the created namespace. + * Get the sku property: The Sku description for a namespace. * * @return the sku value. */ @@ -70,7 +75,7 @@ public Sku sku() { } /** - * Set the sku property: The sku of the created namespace. + * Set the sku property: The Sku description for a namespace. * * @param sku the sku value to set. * @return the NamespaceResourceInner object itself. @@ -80,6 +85,24 @@ public NamespaceResourceInner withSku(Sku sku) { return this; } + /** + * Get the innerProperties property: Represents namespace properties. + * + * @return the innerProperties value. + */ + private NamespaceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the type property: The type of the resource. * @@ -129,7 +152,8 @@ public NamespaceResourceInner withTags(Map tags) { } /** - * Get the name property: The name of the namespace. + * Get the name property: Name of the Notification Hubs namespace. This is immutable property, set automatically + * by the service when the namespace is created. * * @return the name value. */ @@ -138,105 +162,100 @@ public String namePropertiesName() { } /** - * Set the name property: The name of the namespace. + * Get the provisioningState property: Defines values for OperationProvisioningState. * - * @param name the name value to set. + * @return the provisioningState value. + */ + public OperationProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: Defines values for OperationProvisioningState. + * + * @param provisioningState the provisioningState value to set. * @return the NamespaceResourceInner object itself. */ - public NamespaceResourceInner withNamePropertiesName(String name) { + public NamespaceResourceInner withProvisioningState(OperationProvisioningState provisioningState) { if (this.innerProperties() == null) { this.innerProperties = new NamespaceProperties(); } - this.innerProperties().withName(name); + this.innerProperties().withProvisioningState(provisioningState); return this; } /** - * Get the provisioningState property: Provisioning state of the Namespace. + * Get the status property: Namespace status. * - * @return the provisioningState value. + * @return the status value. */ - public String provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + public NamespaceStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); } /** - * Set the provisioningState property: Provisioning state of the Namespace. + * Set the status property: Namespace status. * - * @param provisioningState the provisioningState value to set. + * @param status the status value to set. * @return the NamespaceResourceInner object itself. */ - public NamespaceResourceInner withProvisioningState(String provisioningState) { + public NamespaceResourceInner withStatus(NamespaceStatus status) { if (this.innerProperties() == null) { this.innerProperties = new NamespaceProperties(); } - this.innerProperties().withProvisioningState(provisioningState); + this.innerProperties().withStatus(status); return this; } /** - * Get the region property: 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. + * Get the enabled property: Gets or sets whether or not the namespace is currently enabled. * - * @return the region value. + * @return the enabled value. */ - public String region() { - return this.innerProperties() == null ? null : this.innerProperties().region(); + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); } /** - * Set the region property: 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. + * Get the critical property: Gets or sets whether or not the namespace is set as Critical. * - * @param region the region value to set. - * @return the NamespaceResourceInner object itself. + * @return the critical value. */ - public NamespaceResourceInner withRegion(String region) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withRegion(region); - return this; + public Boolean critical() { + return this.innerProperties() == null ? null : this.innerProperties().critical(); } /** - * Get the metricId property: Identifier for Azure Insights metrics. + * Get the subscriptionId property: Namespace subscription id. * - * @return the metricId value. + * @return the subscriptionId value. */ - public String metricId() { - return this.innerProperties() == null ? null : this.innerProperties().metricId(); + public String subscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().subscriptionId(); } /** - * Get the status property: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = - * Suspended4 = Deleting. + * Get the region property: Region. The value is always set to the same value as Namespace.Location, so we are + * deprecating + * this property. * - * @return the status value. + * @return the region value. */ - public String status() { - return this.innerProperties() == null ? null : this.innerProperties().status(); + public String region() { + return this.innerProperties() == null ? null : this.innerProperties().region(); } /** - * Set the status property: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = - * Suspended4 = Deleting. + * Get the metricId property: Azure Insights Metrics id. * - * @param status the status value to set. - * @return the NamespaceResourceInner object itself. + * @return the metricId value. */ - public NamespaceResourceInner withStatus(String status) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withStatus(status); - return this; + public String metricId() { + return this.innerProperties() == null ? null : this.innerProperties().metricId(); } /** - * Get the createdAt property: The time the namespace was created. + * Get the createdAt property: Time when the namespace was created. * * @return the createdAt value. */ @@ -245,159 +264,173 @@ public OffsetDateTime createdAt() { } /** - * Set the createdAt property: The time the namespace was created. + * Get the updatedAt property: Time when the namespace was updated. * - * @param createdAt the createdAt value to set. - * @return the NamespaceResourceInner object itself. + * @return the updatedAt value. */ - public NamespaceResourceInner withCreatedAt(OffsetDateTime createdAt) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withCreatedAt(createdAt); - return this; + public OffsetDateTime updatedAt() { + return this.innerProperties() == null ? null : this.innerProperties().updatedAt(); } /** - * Get the updatedAt property: The time the namespace was updated. + * Get the namespaceType property: Defines values for NamespaceType. * - * @return the updatedAt value. + * @return the namespaceType value. */ - public OffsetDateTime updatedAt() { - return this.innerProperties() == null ? null : this.innerProperties().updatedAt(); + public NamespaceType namespaceType() { + return this.innerProperties() == null ? null : this.innerProperties().namespaceType(); } /** - * Set the updatedAt property: The time the namespace was updated. + * Set the namespaceType property: Defines values for NamespaceType. * - * @param updatedAt the updatedAt value to set. + * @param namespaceType the namespaceType value to set. * @return the NamespaceResourceInner object itself. */ - public NamespaceResourceInner withUpdatedAt(OffsetDateTime updatedAt) { + public NamespaceResourceInner withNamespaceType(NamespaceType namespaceType) { if (this.innerProperties() == null) { this.innerProperties = new NamespaceProperties(); } - this.innerProperties().withUpdatedAt(updatedAt); + this.innerProperties().withNamespaceType(namespaceType); return this; } /** - * Get the serviceBusEndpoint property: Endpoint you can use to perform NotificationHub operations. + * Get the replicationRegion property: Allowed replication region. * - * @return the serviceBusEndpoint value. + * @return the replicationRegion value. */ - public String serviceBusEndpoint() { - return this.innerProperties() == null ? null : this.innerProperties().serviceBusEndpoint(); + public ReplicationRegion replicationRegion() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRegion(); } /** - * Set the serviceBusEndpoint property: Endpoint you can use to perform NotificationHub operations. + * Set the replicationRegion property: Allowed replication region. * - * @param serviceBusEndpoint the serviceBusEndpoint value to set. + * @param replicationRegion the replicationRegion value to set. * @return the NamespaceResourceInner object itself. */ - public NamespaceResourceInner withServiceBusEndpoint(String serviceBusEndpoint) { + public NamespaceResourceInner withReplicationRegion(ReplicationRegion replicationRegion) { if (this.innerProperties() == null) { this.innerProperties = new NamespaceProperties(); } - this.innerProperties().withServiceBusEndpoint(serviceBusEndpoint); + this.innerProperties().withReplicationRegion(replicationRegion); return this; } /** - * Get the subscriptionId property: The Id of the Azure subscription associated with the namespace. + * Get the zoneRedundancy property: Namespace SKU name. * - * @return the subscriptionId value. + * @return the zoneRedundancy value. */ - public String subscriptionId() { - return this.innerProperties() == null ? null : this.innerProperties().subscriptionId(); + public ZoneRedundancyPreference zoneRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().zoneRedundancy(); } /** - * Set the subscriptionId property: The Id of the Azure subscription associated with the namespace. + * Set the zoneRedundancy property: Namespace SKU name. * - * @param subscriptionId the subscriptionId value to set. + * @param zoneRedundancy the zoneRedundancy value to set. * @return the NamespaceResourceInner object itself. */ - public NamespaceResourceInner withSubscriptionId(String subscriptionId) { + public NamespaceResourceInner withZoneRedundancy(ZoneRedundancyPreference zoneRedundancy) { if (this.innerProperties() == null) { this.innerProperties = new NamespaceProperties(); } - this.innerProperties().withSubscriptionId(subscriptionId); + this.innerProperties().withZoneRedundancy(zoneRedundancy); return this; } /** - * Get the scaleUnit property: ScaleUnit where the namespace gets created. + * Get the networkAcls property: A collection of network authorization rules. * - * @return the scaleUnit value. + * @return the networkAcls value. */ - public String scaleUnit() { - return this.innerProperties() == null ? null : this.innerProperties().scaleUnit(); + public NetworkAcls networkAcls() { + return this.innerProperties() == null ? null : this.innerProperties().networkAcls(); } /** - * Set the scaleUnit property: ScaleUnit where the namespace gets created. + * Set the networkAcls property: A collection of network authorization rules. * - * @param scaleUnit the scaleUnit value to set. + * @param networkAcls the networkAcls value to set. * @return the NamespaceResourceInner object itself. */ - public NamespaceResourceInner withScaleUnit(String scaleUnit) { + public NamespaceResourceInner withNetworkAcls(NetworkAcls networkAcls) { if (this.innerProperties() == null) { this.innerProperties = new NamespaceProperties(); } - this.innerProperties().withScaleUnit(scaleUnit); + this.innerProperties().withNetworkAcls(networkAcls); return this; } /** - * Get the enabled property: Whether or not the namespace is currently enabled. + * Get the pnsCredentials property: Collection of Notification Hub or Notification Hub Namespace PNS credentials. * - * @return the enabled value. + * @return the pnsCredentials value. */ - public Boolean enabled() { - return this.innerProperties() == null ? null : this.innerProperties().enabled(); + public PnsCredentials pnsCredentials() { + return this.innerProperties() == null ? null : this.innerProperties().pnsCredentials(); } /** - * Set the enabled property: Whether or not the namespace is currently enabled. + * Set the pnsCredentials property: Collection of Notification Hub or Notification Hub Namespace PNS credentials. * - * @param enabled the enabled value to set. + * @param pnsCredentials the pnsCredentials value to set. * @return the NamespaceResourceInner object itself. */ - public NamespaceResourceInner withEnabled(Boolean enabled) { + public NamespaceResourceInner withPnsCredentials(PnsCredentials pnsCredentials) { if (this.innerProperties() == null) { this.innerProperties = new NamespaceProperties(); } - this.innerProperties().withEnabled(enabled); + this.innerProperties().withPnsCredentials(pnsCredentials); return this; } /** - * Get the critical property: Whether or not the namespace is set as Critical. + * Get the serviceBusEndpoint property: Gets or sets endpoint you can use to perform NotificationHub + * operations. * - * @return the critical value. + * @return the serviceBusEndpoint value. */ - public Boolean critical() { - return this.innerProperties() == null ? null : this.innerProperties().critical(); + public String serviceBusEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().serviceBusEndpoint(); + } + + /** + * Get the privateEndpointConnections property: Private Endpoint Connections for namespace. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); } /** - * Set the critical property: Whether or not the namespace is set as Critical. + * Get the scaleUnit property: Gets or sets scaleUnit where the namespace gets created. * - * @param critical the critical value to set. + * @return the scaleUnit value. + */ + public String scaleUnit() { + return this.innerProperties() == null ? null : this.innerProperties().scaleUnit(); + } + + /** + * Set the scaleUnit property: Gets or sets scaleUnit where the namespace gets created. + * + * @param scaleUnit the scaleUnit value to set. * @return the NamespaceResourceInner object itself. */ - public NamespaceResourceInner withCritical(Boolean critical) { + public NamespaceResourceInner withScaleUnit(String scaleUnit) { if (this.innerProperties() == null) { this.innerProperties = new NamespaceProperties(); } - this.innerProperties().withCritical(critical); + this.innerProperties().withScaleUnit(scaleUnit); return this; } /** - * Get the dataCenter property: Data center for the namespace. + * Get the dataCenter property: Deprecated. * * @return the dataCenter value. */ @@ -406,7 +439,7 @@ public String dataCenter() { } /** - * Set the dataCenter property: Data center for the namespace. + * Set the dataCenter property: Deprecated. * * @param dataCenter the dataCenter value to set. * @return the NamespaceResourceInner object itself. @@ -420,25 +453,25 @@ public NamespaceResourceInner withDataCenter(String dataCenter) { } /** - * Get the namespaceType property: The namespace type. + * Get the publicNetworkAccess property: Type of public network access. * - * @return the namespaceType value. + * @return the publicNetworkAccess value. */ - public NamespaceType namespaceType() { - return this.innerProperties() == null ? null : this.innerProperties().namespaceType(); + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); } /** - * Set the namespaceType property: The namespace type. + * Set the publicNetworkAccess property: Type of public network access. * - * @param namespaceType the namespaceType value to set. + * @param publicNetworkAccess the publicNetworkAccess value to set. * @return the NamespaceResourceInner object itself. */ - public NamespaceResourceInner withNamespaceType(NamespaceType namespaceType) { + public NamespaceResourceInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { if (this.innerProperties() == null) { this.innerProperties = new NamespaceProperties(); } - this.innerProperties().withNamespaceType(namespaceType); + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); return this; } @@ -448,14 +481,19 @@ public NamespaceResourceInner withNamespaceType(NamespaceType namespaceType) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (sku() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property sku in model NamespaceResourceInner")); + } else { + sku().validate(); + } if (innerProperties() != null) { innerProperties().validate(); } - if (sku() != null) { - sku().validate(); - } } + private static final ClientLogger LOGGER = new ClientLogger(NamespaceResourceInner.class); + /** * {@inheritDoc} */ @@ -464,8 +502,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("location", location()); jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeJsonField("properties", this.innerProperties); return jsonWriter.writeEndObject(); } @@ -496,10 +534,12 @@ public static NamespaceResourceInner fromJson(JsonReader jsonReader) throws IOEx } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); deserializedNamespaceResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedNamespaceResourceInner.innerProperties = NamespaceProperties.fromJson(reader); } else if ("sku".equals(fieldName)) { deserializedNamespaceResourceInner.sku = Sku.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedNamespaceResourceInner.innerProperties = NamespaceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedNamespaceResourceInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NotificationHubProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NotificationHubProperties.java index bfc1f8d7fc4b..9b9ab07513bc 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NotificationHubProperties.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NotificationHubProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; @@ -12,9 +12,12 @@ import com.azure.resourcemanager.notificationhubs.models.AdmCredential; import com.azure.resourcemanager.notificationhubs.models.ApnsCredential; import com.azure.resourcemanager.notificationhubs.models.BaiduCredential; +import com.azure.resourcemanager.notificationhubs.models.BrowserCredential; +import com.azure.resourcemanager.notificationhubs.models.FcmV1Credential; import com.azure.resourcemanager.notificationhubs.models.GcmCredential; import com.azure.resourcemanager.notificationhubs.models.MpnsCredential; import com.azure.resourcemanager.notificationhubs.models.WnsCredential; +import com.azure.resourcemanager.notificationhubs.models.XiaomiCredential; import java.io.IOException; import java.util.List; @@ -24,50 +27,70 @@ @Fluent public final class NotificationHubProperties implements JsonSerializable { /* - * The NotificationHub name. + * Gets or sets the NotificationHub name. */ private String name; /* - * The RegistrationTtl of the created NotificationHub + * Gets or sets the RegistrationTtl of the created NotificationHub */ private String registrationTtl; /* - * The AuthorizationRules of the created NotificationHub + * Gets or sets the AuthorizationRules of the created NotificationHub */ private List authorizationRules; /* - * The ApnsCredential of the created NotificationHub + * Description of a NotificationHub ApnsCredential. */ private ApnsCredential apnsCredential; /* - * The WnsCredential of the created NotificationHub + * Description of a NotificationHub WnsCredential. */ private WnsCredential wnsCredential; /* - * The GcmCredential of the created NotificationHub + * Description of a NotificationHub GcmCredential. */ private GcmCredential gcmCredential; /* - * The MpnsCredential of the created NotificationHub + * Description of a NotificationHub MpnsCredential. */ private MpnsCredential mpnsCredential; /* - * The AdmCredential of the created NotificationHub + * Description of a NotificationHub AdmCredential. */ private AdmCredential admCredential; /* - * The BaiduCredential of the created NotificationHub + * Description of a NotificationHub BaiduCredential. */ private BaiduCredential baiduCredential; + /* + * Description of a NotificationHub BrowserCredential. + */ + private BrowserCredential browserCredential; + + /* + * Description of a NotificationHub XiaomiCredential. + */ + private XiaomiCredential xiaomiCredential; + + /* + * Description of a NotificationHub FcmV1Credential. + */ + private FcmV1Credential fcmV1Credential; + + /* + * The dailyMaxActiveDevices property. + */ + private Long dailyMaxActiveDevices; + /** * Creates an instance of NotificationHubProperties class. */ @@ -75,7 +98,7 @@ public NotificationHubProperties() { } /** - * Get the name property: The NotificationHub name. + * Get the name property: Gets or sets the NotificationHub name. * * @return the name value. */ @@ -84,7 +107,7 @@ public String name() { } /** - * Set the name property: The NotificationHub name. + * Set the name property: Gets or sets the NotificationHub name. * * @param name the name value to set. * @return the NotificationHubProperties object itself. @@ -95,7 +118,7 @@ public NotificationHubProperties withName(String name) { } /** - * Get the registrationTtl property: The RegistrationTtl of the created NotificationHub. + * Get the registrationTtl property: Gets or sets the RegistrationTtl of the created NotificationHub. * * @return the registrationTtl value. */ @@ -104,7 +127,7 @@ public String registrationTtl() { } /** - * Set the registrationTtl property: The RegistrationTtl of the created NotificationHub. + * Set the registrationTtl property: Gets or sets the RegistrationTtl of the created NotificationHub. * * @param registrationTtl the registrationTtl value to set. * @return the NotificationHubProperties object itself. @@ -115,7 +138,7 @@ public NotificationHubProperties withRegistrationTtl(String registrationTtl) { } /** - * Get the authorizationRules property: The AuthorizationRules of the created NotificationHub. + * Get the authorizationRules property: Gets or sets the AuthorizationRules of the created NotificationHub. * * @return the authorizationRules value. */ @@ -124,19 +147,7 @@ public List authorizationRules() { } /** - * Set the authorizationRules property: The AuthorizationRules of the created NotificationHub. - * - * @param authorizationRules the authorizationRules value to set. - * @return the NotificationHubProperties object itself. - */ - public NotificationHubProperties - withAuthorizationRules(List authorizationRules) { - this.authorizationRules = authorizationRules; - return this; - } - - /** - * Get the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Get the apnsCredential property: Description of a NotificationHub ApnsCredential. * * @return the apnsCredential value. */ @@ -145,7 +156,7 @@ public ApnsCredential apnsCredential() { } /** - * Set the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Set the apnsCredential property: Description of a NotificationHub ApnsCredential. * * @param apnsCredential the apnsCredential value to set. * @return the NotificationHubProperties object itself. @@ -156,7 +167,7 @@ public NotificationHubProperties withApnsCredential(ApnsCredential apnsCredentia } /** - * Get the wnsCredential property: The WnsCredential of the created NotificationHub. + * Get the wnsCredential property: Description of a NotificationHub WnsCredential. * * @return the wnsCredential value. */ @@ -165,7 +176,7 @@ public WnsCredential wnsCredential() { } /** - * Set the wnsCredential property: The WnsCredential of the created NotificationHub. + * Set the wnsCredential property: Description of a NotificationHub WnsCredential. * * @param wnsCredential the wnsCredential value to set. * @return the NotificationHubProperties object itself. @@ -176,7 +187,7 @@ public NotificationHubProperties withWnsCredential(WnsCredential wnsCredential) } /** - * Get the gcmCredential property: The GcmCredential of the created NotificationHub. + * Get the gcmCredential property: Description of a NotificationHub GcmCredential. * * @return the gcmCredential value. */ @@ -185,7 +196,7 @@ public GcmCredential gcmCredential() { } /** - * Set the gcmCredential property: The GcmCredential of the created NotificationHub. + * Set the gcmCredential property: Description of a NotificationHub GcmCredential. * * @param gcmCredential the gcmCredential value to set. * @return the NotificationHubProperties object itself. @@ -196,7 +207,7 @@ public NotificationHubProperties withGcmCredential(GcmCredential gcmCredential) } /** - * Get the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Get the mpnsCredential property: Description of a NotificationHub MpnsCredential. * * @return the mpnsCredential value. */ @@ -205,7 +216,7 @@ public MpnsCredential mpnsCredential() { } /** - * Set the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Set the mpnsCredential property: Description of a NotificationHub MpnsCredential. * * @param mpnsCredential the mpnsCredential value to set. * @return the NotificationHubProperties object itself. @@ -216,7 +227,7 @@ public NotificationHubProperties withMpnsCredential(MpnsCredential mpnsCredentia } /** - * Get the admCredential property: The AdmCredential of the created NotificationHub. + * Get the admCredential property: Description of a NotificationHub AdmCredential. * * @return the admCredential value. */ @@ -225,7 +236,7 @@ public AdmCredential admCredential() { } /** - * Set the admCredential property: The AdmCredential of the created NotificationHub. + * Set the admCredential property: Description of a NotificationHub AdmCredential. * * @param admCredential the admCredential value to set. * @return the NotificationHubProperties object itself. @@ -236,7 +247,7 @@ public NotificationHubProperties withAdmCredential(AdmCredential admCredential) } /** - * Get the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Get the baiduCredential property: Description of a NotificationHub BaiduCredential. * * @return the baiduCredential value. */ @@ -245,7 +256,7 @@ public BaiduCredential baiduCredential() { } /** - * Set the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Set the baiduCredential property: Description of a NotificationHub BaiduCredential. * * @param baiduCredential the baiduCredential value to set. * @return the NotificationHubProperties object itself. @@ -255,6 +266,75 @@ public NotificationHubProperties withBaiduCredential(BaiduCredential baiduCreden return this; } + /** + * Get the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @return the browserCredential value. + */ + public BrowserCredential browserCredential() { + return this.browserCredential; + } + + /** + * Set the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @param browserCredential the browserCredential value to set. + * @return the NotificationHubProperties object itself. + */ + public NotificationHubProperties withBrowserCredential(BrowserCredential browserCredential) { + this.browserCredential = browserCredential; + return this; + } + + /** + * Get the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. + * + * @return the xiaomiCredential value. + */ + public XiaomiCredential xiaomiCredential() { + return this.xiaomiCredential; + } + + /** + * Set the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. + * + * @param xiaomiCredential the xiaomiCredential value to set. + * @return the NotificationHubProperties object itself. + */ + public NotificationHubProperties withXiaomiCredential(XiaomiCredential xiaomiCredential) { + this.xiaomiCredential = xiaomiCredential; + return this; + } + + /** + * Get the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @return the fcmV1Credential value. + */ + public FcmV1Credential fcmV1Credential() { + return this.fcmV1Credential; + } + + /** + * Set the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @param fcmV1Credential the fcmV1Credential value to set. + * @return the NotificationHubProperties object itself. + */ + public NotificationHubProperties withFcmV1Credential(FcmV1Credential fcmV1Credential) { + this.fcmV1Credential = fcmV1Credential; + return this; + } + + /** + * Get the dailyMaxActiveDevices property: The dailyMaxActiveDevices property. + * + * @return the dailyMaxActiveDevices value. + */ + public Long dailyMaxActiveDevices() { + return this.dailyMaxActiveDevices; + } + /** * Validates the instance. * @@ -282,6 +362,15 @@ public void validate() { if (baiduCredential() != null) { baiduCredential().validate(); } + if (browserCredential() != null) { + browserCredential().validate(); + } + if (xiaomiCredential() != null) { + xiaomiCredential().validate(); + } + if (fcmV1Credential() != null) { + fcmV1Credential().validate(); + } } /** @@ -292,14 +381,15 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("name", this.name); jsonWriter.writeStringField("registrationTtl", this.registrationTtl); - jsonWriter.writeArrayField("authorizationRules", this.authorizationRules, - (writer, element) -> writer.writeJson(element)); jsonWriter.writeJsonField("apnsCredential", this.apnsCredential); jsonWriter.writeJsonField("wnsCredential", this.wnsCredential); jsonWriter.writeJsonField("gcmCredential", this.gcmCredential); jsonWriter.writeJsonField("mpnsCredential", this.mpnsCredential); jsonWriter.writeJsonField("admCredential", this.admCredential); jsonWriter.writeJsonField("baiduCredential", this.baiduCredential); + jsonWriter.writeJsonField("browserCredential", this.browserCredential); + jsonWriter.writeJsonField("xiaomiCredential", this.xiaomiCredential); + jsonWriter.writeJsonField("fcmV1Credential", this.fcmV1Credential); return jsonWriter.writeEndObject(); } @@ -338,6 +428,15 @@ public static NotificationHubProperties fromJson(JsonReader jsonReader) throws I deserializedNotificationHubProperties.admCredential = AdmCredential.fromJson(reader); } else if ("baiduCredential".equals(fieldName)) { deserializedNotificationHubProperties.baiduCredential = BaiduCredential.fromJson(reader); + } else if ("browserCredential".equals(fieldName)) { + deserializedNotificationHubProperties.browserCredential = BrowserCredential.fromJson(reader); + } else if ("xiaomiCredential".equals(fieldName)) { + deserializedNotificationHubProperties.xiaomiCredential = XiaomiCredential.fromJson(reader); + } else if ("fcmV1Credential".equals(fieldName)) { + deserializedNotificationHubProperties.fcmV1Credential = FcmV1Credential.fromJson(reader); + } else if ("dailyMaxActiveDevices".equals(fieldName)) { + deserializedNotificationHubProperties.dailyMaxActiveDevices + = reader.getNullable(JsonReader::getLong); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NotificationHubResourceInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NotificationHubResourceInner.java index ec55d04b0ccf..9653cee98fd4 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NotificationHubResourceInner.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/NotificationHubResourceInner.java @@ -1,40 +1,49 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.notificationhubs.models.AdmCredential; import com.azure.resourcemanager.notificationhubs.models.ApnsCredential; import com.azure.resourcemanager.notificationhubs.models.BaiduCredential; +import com.azure.resourcemanager.notificationhubs.models.BrowserCredential; +import com.azure.resourcemanager.notificationhubs.models.FcmV1Credential; import com.azure.resourcemanager.notificationhubs.models.GcmCredential; import com.azure.resourcemanager.notificationhubs.models.MpnsCredential; import com.azure.resourcemanager.notificationhubs.models.Sku; import com.azure.resourcemanager.notificationhubs.models.WnsCredential; +import com.azure.resourcemanager.notificationhubs.models.XiaomiCredential; import java.io.IOException; import java.util.List; import java.util.Map; /** - * Description of a NotificationHub Resource. + * Notification Hub Resource. */ @Fluent public final class NotificationHubResourceInner extends Resource { /* - * Properties of the NotificationHub. + * NotificationHub properties. */ private NotificationHubProperties innerProperties; /* - * The sku of the created namespace + * The Sku description for a namespace */ private Sku sku; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -57,7 +66,7 @@ public NotificationHubResourceInner() { } /** - * Get the innerProperties property: Properties of the NotificationHub. + * Get the innerProperties property: NotificationHub properties. * * @return the innerProperties value. */ @@ -66,7 +75,7 @@ private NotificationHubProperties innerProperties() { } /** - * Get the sku property: The sku of the created namespace. + * Get the sku property: The Sku description for a namespace. * * @return the sku value. */ @@ -75,7 +84,7 @@ public Sku sku() { } /** - * Set the sku property: The sku of the created namespace. + * Set the sku property: The Sku description for a namespace. * * @param sku the sku value to set. * @return the NotificationHubResourceInner object itself. @@ -85,6 +94,15 @@ public NotificationHubResourceInner withSku(Sku sku) { return this; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the type property: The type of the resource. * @@ -134,7 +152,7 @@ public NotificationHubResourceInner withTags(Map tags) { } /** - * Get the name property: The NotificationHub name. + * Get the name property: Gets or sets the NotificationHub name. * * @return the name value. */ @@ -143,7 +161,7 @@ public String namePropertiesName() { } /** - * Set the name property: The NotificationHub name. + * Set the name property: Gets or sets the NotificationHub name. * * @param name the name value to set. * @return the NotificationHubResourceInner object itself. @@ -157,7 +175,7 @@ public NotificationHubResourceInner withNamePropertiesName(String name) { } /** - * Get the registrationTtl property: The RegistrationTtl of the created NotificationHub. + * Get the registrationTtl property: Gets or sets the RegistrationTtl of the created NotificationHub. * * @return the registrationTtl value. */ @@ -166,7 +184,7 @@ public String registrationTtl() { } /** - * Set the registrationTtl property: The RegistrationTtl of the created NotificationHub. + * Set the registrationTtl property: Gets or sets the RegistrationTtl of the created NotificationHub. * * @param registrationTtl the registrationTtl value to set. * @return the NotificationHubResourceInner object itself. @@ -180,7 +198,7 @@ public NotificationHubResourceInner withRegistrationTtl(String registrationTtl) } /** - * Get the authorizationRules property: The AuthorizationRules of the created NotificationHub. + * Get the authorizationRules property: Gets or sets the AuthorizationRules of the created NotificationHub. * * @return the authorizationRules value. */ @@ -189,22 +207,7 @@ public List authorizationRules() { } /** - * Set the authorizationRules property: The AuthorizationRules of the created NotificationHub. - * - * @param authorizationRules the authorizationRules value to set. - * @return the NotificationHubResourceInner object itself. - */ - public NotificationHubResourceInner - withAuthorizationRules(List authorizationRules) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withAuthorizationRules(authorizationRules); - return this; - } - - /** - * Get the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Get the apnsCredential property: Description of a NotificationHub ApnsCredential. * * @return the apnsCredential value. */ @@ -213,7 +216,7 @@ public ApnsCredential apnsCredential() { } /** - * Set the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Set the apnsCredential property: Description of a NotificationHub ApnsCredential. * * @param apnsCredential the apnsCredential value to set. * @return the NotificationHubResourceInner object itself. @@ -227,7 +230,7 @@ public NotificationHubResourceInner withApnsCredential(ApnsCredential apnsCreden } /** - * Get the wnsCredential property: The WnsCredential of the created NotificationHub. + * Get the wnsCredential property: Description of a NotificationHub WnsCredential. * * @return the wnsCredential value. */ @@ -236,7 +239,7 @@ public WnsCredential wnsCredential() { } /** - * Set the wnsCredential property: The WnsCredential of the created NotificationHub. + * Set the wnsCredential property: Description of a NotificationHub WnsCredential. * * @param wnsCredential the wnsCredential value to set. * @return the NotificationHubResourceInner object itself. @@ -250,7 +253,7 @@ public NotificationHubResourceInner withWnsCredential(WnsCredential wnsCredentia } /** - * Get the gcmCredential property: The GcmCredential of the created NotificationHub. + * Get the gcmCredential property: Description of a NotificationHub GcmCredential. * * @return the gcmCredential value. */ @@ -259,7 +262,7 @@ public GcmCredential gcmCredential() { } /** - * Set the gcmCredential property: The GcmCredential of the created NotificationHub. + * Set the gcmCredential property: Description of a NotificationHub GcmCredential. * * @param gcmCredential the gcmCredential value to set. * @return the NotificationHubResourceInner object itself. @@ -273,7 +276,7 @@ public NotificationHubResourceInner withGcmCredential(GcmCredential gcmCredentia } /** - * Get the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Get the mpnsCredential property: Description of a NotificationHub MpnsCredential. * * @return the mpnsCredential value. */ @@ -282,7 +285,7 @@ public MpnsCredential mpnsCredential() { } /** - * Set the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Set the mpnsCredential property: Description of a NotificationHub MpnsCredential. * * @param mpnsCredential the mpnsCredential value to set. * @return the NotificationHubResourceInner object itself. @@ -296,7 +299,7 @@ public NotificationHubResourceInner withMpnsCredential(MpnsCredential mpnsCreden } /** - * Get the admCredential property: The AdmCredential of the created NotificationHub. + * Get the admCredential property: Description of a NotificationHub AdmCredential. * * @return the admCredential value. */ @@ -305,7 +308,7 @@ public AdmCredential admCredential() { } /** - * Set the admCredential property: The AdmCredential of the created NotificationHub. + * Set the admCredential property: Description of a NotificationHub AdmCredential. * * @param admCredential the admCredential value to set. * @return the NotificationHubResourceInner object itself. @@ -319,7 +322,7 @@ public NotificationHubResourceInner withAdmCredential(AdmCredential admCredentia } /** - * Get the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Get the baiduCredential property: Description of a NotificationHub BaiduCredential. * * @return the baiduCredential value. */ @@ -328,7 +331,7 @@ public BaiduCredential baiduCredential() { } /** - * Set the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Set the baiduCredential property: Description of a NotificationHub BaiduCredential. * * @param baiduCredential the baiduCredential value to set. * @return the NotificationHubResourceInner object itself. @@ -341,6 +344,84 @@ public NotificationHubResourceInner withBaiduCredential(BaiduCredential baiduCre return this; } + /** + * Get the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @return the browserCredential value. + */ + public BrowserCredential browserCredential() { + return this.innerProperties() == null ? null : this.innerProperties().browserCredential(); + } + + /** + * Set the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @param browserCredential the browserCredential value to set. + * @return the NotificationHubResourceInner object itself. + */ + public NotificationHubResourceInner withBrowserCredential(BrowserCredential browserCredential) { + if (this.innerProperties() == null) { + this.innerProperties = new NotificationHubProperties(); + } + this.innerProperties().withBrowserCredential(browserCredential); + return this; + } + + /** + * Get the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. + * + * @return the xiaomiCredential value. + */ + public XiaomiCredential xiaomiCredential() { + return this.innerProperties() == null ? null : this.innerProperties().xiaomiCredential(); + } + + /** + * Set the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. + * + * @param xiaomiCredential the xiaomiCredential value to set. + * @return the NotificationHubResourceInner object itself. + */ + public NotificationHubResourceInner withXiaomiCredential(XiaomiCredential xiaomiCredential) { + if (this.innerProperties() == null) { + this.innerProperties = new NotificationHubProperties(); + } + this.innerProperties().withXiaomiCredential(xiaomiCredential); + return this; + } + + /** + * Get the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @return the fcmV1Credential value. + */ + public FcmV1Credential fcmV1Credential() { + return this.innerProperties() == null ? null : this.innerProperties().fcmV1Credential(); + } + + /** + * Set the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @param fcmV1Credential the fcmV1Credential value to set. + * @return the NotificationHubResourceInner object itself. + */ + public NotificationHubResourceInner withFcmV1Credential(FcmV1Credential fcmV1Credential) { + if (this.innerProperties() == null) { + this.innerProperties = new NotificationHubProperties(); + } + this.innerProperties().withFcmV1Credential(fcmV1Credential); + return this; + } + + /** + * Get the dailyMaxActiveDevices property: The dailyMaxActiveDevices property. + * + * @return the dailyMaxActiveDevices value. + */ + public Long dailyMaxActiveDevices() { + return this.innerProperties() == null ? null : this.innerProperties().dailyMaxActiveDevices(); + } + /** * Validates the instance. * @@ -400,6 +481,8 @@ public static NotificationHubResourceInner fromJson(JsonReader jsonReader) throw = NotificationHubProperties.fromJson(reader); } else if ("sku".equals(fieldName)) { deserializedNotificationHubResourceInner.sku = Sku.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedNotificationHubResourceInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/OperationInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/OperationInner.java index 2638cb7ee72a..204fdc42b7c3 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/OperationInner.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/OperationInner.java @@ -1,40 +1,51 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.notificationhubs.models.OperationDisplay; +import com.azure.resourcemanager.notificationhubs.models.OperationProperties; import java.io.IOException; /** - * A NotificationHubs REST API operation. + * Result of the request to list SQL operations. */ -@Fluent +@Immutable public final class OperationInner implements JsonSerializable { /* - * Operation name: {provider}/{resource}/{operation} + * The name of the operation being performed on this particular object." */ private String name; /* - * The object that represents the operation. + * he localized display information for this particular operation / action. */ private OperationDisplay display; + /* + * The intended executor of the operation." + */ + private Boolean isDataAction; + + /* + * Additional descriptions for the operation. + */ + private OperationProperties properties; + /** * Creates an instance of OperationInner class. */ - public OperationInner() { + private OperationInner() { } /** - * Get the name property: Operation name: {provider}/{resource}/{operation}. + * Get the name property: The name of the operation being performed on this particular object.". * * @return the name value. */ @@ -43,7 +54,7 @@ public String name() { } /** - * Get the display property: The object that represents the operation. + * Get the display property: he localized display information for this particular operation / action. * * @return the display value. */ @@ -52,14 +63,21 @@ public OperationDisplay display() { } /** - * Set the display property: The object that represents the operation. + * Get the isDataAction property: The intended executor of the operation.". * - * @param display the display value to set. - * @return the OperationInner object itself. + * @return the isDataAction value. */ - public OperationInner withDisplay(OperationDisplay display) { - this.display = display; - return this; + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + public OperationProperties properties() { + return this.properties; } /** @@ -71,6 +89,9 @@ public void validate() { if (display() != null) { display().validate(); } + if (properties() != null) { + properties().validate(); + } } /** @@ -80,6 +101,7 @@ public void validate() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeJsonField("display", this.display); + jsonWriter.writeJsonField("properties", this.properties); return jsonWriter.writeEndObject(); } @@ -102,6 +124,10 @@ public static OperationInner fromJson(JsonReader jsonReader) throws IOException deserializedOperationInner.name = reader.getString(); } else if ("display".equals(fieldName)) { deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("properties".equals(fieldName)) { + deserializedOperationInner.properties = OperationProperties.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentials.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentials.java new file mode 100644 index 000000000000..1cfacebc62d3 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentials.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.models.AdmCredential; +import com.azure.resourcemanager.notificationhubs.models.ApnsCredential; +import com.azure.resourcemanager.notificationhubs.models.BaiduCredential; +import com.azure.resourcemanager.notificationhubs.models.BrowserCredential; +import com.azure.resourcemanager.notificationhubs.models.FcmV1Credential; +import com.azure.resourcemanager.notificationhubs.models.GcmCredential; +import com.azure.resourcemanager.notificationhubs.models.MpnsCredential; +import com.azure.resourcemanager.notificationhubs.models.WnsCredential; +import com.azure.resourcemanager.notificationhubs.models.XiaomiCredential; +import java.io.IOException; + +/** + * Collection of Notification Hub or Notification Hub Namespace PNS credentials. + */ +@Fluent +public final class PnsCredentials implements JsonSerializable { + /* + * Description of a NotificationHub AdmCredential. + */ + private AdmCredential admCredential; + + /* + * Description of a NotificationHub ApnsCredential. + */ + private ApnsCredential apnsCredential; + + /* + * Description of a NotificationHub BaiduCredential. + */ + private BaiduCredential baiduCredential; + + /* + * Description of a NotificationHub BrowserCredential. + */ + private BrowserCredential browserCredential; + + /* + * Description of a NotificationHub GcmCredential. + */ + private GcmCredential gcmCredential; + + /* + * Description of a NotificationHub MpnsCredential. + */ + private MpnsCredential mpnsCredential; + + /* + * Description of a NotificationHub WnsCredential. + */ + private WnsCredential wnsCredential; + + /* + * Description of a NotificationHub XiaomiCredential. + */ + private XiaomiCredential xiaomiCredential; + + /* + * Description of a NotificationHub FcmV1Credential. + */ + private FcmV1Credential fcmV1Credential; + + /** + * Creates an instance of PnsCredentials class. + */ + public PnsCredentials() { + } + + /** + * Get the admCredential property: Description of a NotificationHub AdmCredential. + * + * @return the admCredential value. + */ + public AdmCredential admCredential() { + return this.admCredential; + } + + /** + * Set the admCredential property: Description of a NotificationHub AdmCredential. + * + * @param admCredential the admCredential value to set. + * @return the PnsCredentials object itself. + */ + public PnsCredentials withAdmCredential(AdmCredential admCredential) { + this.admCredential = admCredential; + return this; + } + + /** + * Get the apnsCredential property: Description of a NotificationHub ApnsCredential. + * + * @return the apnsCredential value. + */ + public ApnsCredential apnsCredential() { + return this.apnsCredential; + } + + /** + * Set the apnsCredential property: Description of a NotificationHub ApnsCredential. + * + * @param apnsCredential the apnsCredential value to set. + * @return the PnsCredentials object itself. + */ + public PnsCredentials withApnsCredential(ApnsCredential apnsCredential) { + this.apnsCredential = apnsCredential; + return this; + } + + /** + * Get the baiduCredential property: Description of a NotificationHub BaiduCredential. + * + * @return the baiduCredential value. + */ + public BaiduCredential baiduCredential() { + return this.baiduCredential; + } + + /** + * Set the baiduCredential property: Description of a NotificationHub BaiduCredential. + * + * @param baiduCredential the baiduCredential value to set. + * @return the PnsCredentials object itself. + */ + public PnsCredentials withBaiduCredential(BaiduCredential baiduCredential) { + this.baiduCredential = baiduCredential; + return this; + } + + /** + * Get the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @return the browserCredential value. + */ + public BrowserCredential browserCredential() { + return this.browserCredential; + } + + /** + * Set the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @param browserCredential the browserCredential value to set. + * @return the PnsCredentials object itself. + */ + public PnsCredentials withBrowserCredential(BrowserCredential browserCredential) { + this.browserCredential = browserCredential; + return this; + } + + /** + * Get the gcmCredential property: Description of a NotificationHub GcmCredential. + * + * @return the gcmCredential value. + */ + public GcmCredential gcmCredential() { + return this.gcmCredential; + } + + /** + * Set the gcmCredential property: Description of a NotificationHub GcmCredential. + * + * @param gcmCredential the gcmCredential value to set. + * @return the PnsCredentials object itself. + */ + public PnsCredentials withGcmCredential(GcmCredential gcmCredential) { + this.gcmCredential = gcmCredential; + return this; + } + + /** + * Get the mpnsCredential property: Description of a NotificationHub MpnsCredential. + * + * @return the mpnsCredential value. + */ + public MpnsCredential mpnsCredential() { + return this.mpnsCredential; + } + + /** + * Set the mpnsCredential property: Description of a NotificationHub MpnsCredential. + * + * @param mpnsCredential the mpnsCredential value to set. + * @return the PnsCredentials object itself. + */ + public PnsCredentials withMpnsCredential(MpnsCredential mpnsCredential) { + this.mpnsCredential = mpnsCredential; + return this; + } + + /** + * Get the wnsCredential property: Description of a NotificationHub WnsCredential. + * + * @return the wnsCredential value. + */ + public WnsCredential wnsCredential() { + return this.wnsCredential; + } + + /** + * Set the wnsCredential property: Description of a NotificationHub WnsCredential. + * + * @param wnsCredential the wnsCredential value to set. + * @return the PnsCredentials object itself. + */ + public PnsCredentials withWnsCredential(WnsCredential wnsCredential) { + this.wnsCredential = wnsCredential; + return this; + } + + /** + * Get the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. + * + * @return the xiaomiCredential value. + */ + public XiaomiCredential xiaomiCredential() { + return this.xiaomiCredential; + } + + /** + * Set the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. + * + * @param xiaomiCredential the xiaomiCredential value to set. + * @return the PnsCredentials object itself. + */ + public PnsCredentials withXiaomiCredential(XiaomiCredential xiaomiCredential) { + this.xiaomiCredential = xiaomiCredential; + return this; + } + + /** + * Get the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @return the fcmV1Credential value. + */ + public FcmV1Credential fcmV1Credential() { + return this.fcmV1Credential; + } + + /** + * Set the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @param fcmV1Credential the fcmV1Credential value to set. + * @return the PnsCredentials object itself. + */ + public PnsCredentials withFcmV1Credential(FcmV1Credential fcmV1Credential) { + this.fcmV1Credential = fcmV1Credential; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (admCredential() != null) { + admCredential().validate(); + } + if (apnsCredential() != null) { + apnsCredential().validate(); + } + if (baiduCredential() != null) { + baiduCredential().validate(); + } + if (browserCredential() != null) { + browserCredential().validate(); + } + if (gcmCredential() != null) { + gcmCredential().validate(); + } + if (mpnsCredential() != null) { + mpnsCredential().validate(); + } + if (wnsCredential() != null) { + wnsCredential().validate(); + } + if (xiaomiCredential() != null) { + xiaomiCredential().validate(); + } + if (fcmV1Credential() != null) { + fcmV1Credential().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("admCredential", this.admCredential); + jsonWriter.writeJsonField("apnsCredential", this.apnsCredential); + jsonWriter.writeJsonField("baiduCredential", this.baiduCredential); + jsonWriter.writeJsonField("browserCredential", this.browserCredential); + jsonWriter.writeJsonField("gcmCredential", this.gcmCredential); + jsonWriter.writeJsonField("mpnsCredential", this.mpnsCredential); + jsonWriter.writeJsonField("wnsCredential", this.wnsCredential); + jsonWriter.writeJsonField("xiaomiCredential", this.xiaomiCredential); + jsonWriter.writeJsonField("fcmV1Credential", this.fcmV1Credential); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PnsCredentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PnsCredentials if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PnsCredentials. + */ + public static PnsCredentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PnsCredentials deserializedPnsCredentials = new PnsCredentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("admCredential".equals(fieldName)) { + deserializedPnsCredentials.admCredential = AdmCredential.fromJson(reader); + } else if ("apnsCredential".equals(fieldName)) { + deserializedPnsCredentials.apnsCredential = ApnsCredential.fromJson(reader); + } else if ("baiduCredential".equals(fieldName)) { + deserializedPnsCredentials.baiduCredential = BaiduCredential.fromJson(reader); + } else if ("browserCredential".equals(fieldName)) { + deserializedPnsCredentials.browserCredential = BrowserCredential.fromJson(reader); + } else if ("gcmCredential".equals(fieldName)) { + deserializedPnsCredentials.gcmCredential = GcmCredential.fromJson(reader); + } else if ("mpnsCredential".equals(fieldName)) { + deserializedPnsCredentials.mpnsCredential = MpnsCredential.fromJson(reader); + } else if ("wnsCredential".equals(fieldName)) { + deserializedPnsCredentials.wnsCredential = WnsCredential.fromJson(reader); + } else if ("xiaomiCredential".equals(fieldName)) { + deserializedPnsCredentials.xiaomiCredential = XiaomiCredential.fromJson(reader); + } else if ("fcmV1Credential".equals(fieldName)) { + deserializedPnsCredentials.fcmV1Credential = FcmV1Credential.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPnsCredentials; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentialsProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentialsProperties.java deleted file mode 100644 index 817af2581157..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentialsProperties.java +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.notificationhubs.models.AdmCredential; -import com.azure.resourcemanager.notificationhubs.models.ApnsCredential; -import com.azure.resourcemanager.notificationhubs.models.BaiduCredential; -import com.azure.resourcemanager.notificationhubs.models.GcmCredential; -import com.azure.resourcemanager.notificationhubs.models.MpnsCredential; -import com.azure.resourcemanager.notificationhubs.models.WnsCredential; -import java.io.IOException; - -/** - * Description of a NotificationHub PNS Credentials. - */ -@Fluent -public final class PnsCredentialsProperties implements JsonSerializable { - /* - * The ApnsCredential of the created NotificationHub - */ - private ApnsCredential apnsCredential; - - /* - * The WnsCredential of the created NotificationHub - */ - private WnsCredential wnsCredential; - - /* - * The GcmCredential of the created NotificationHub - */ - private GcmCredential gcmCredential; - - /* - * The MpnsCredential of the created NotificationHub - */ - private MpnsCredential mpnsCredential; - - /* - * The AdmCredential of the created NotificationHub - */ - private AdmCredential admCredential; - - /* - * The BaiduCredential of the created NotificationHub - */ - private BaiduCredential baiduCredential; - - /** - * Creates an instance of PnsCredentialsProperties class. - */ - public PnsCredentialsProperties() { - } - - /** - * Get the apnsCredential property: The ApnsCredential of the created NotificationHub. - * - * @return the apnsCredential value. - */ - public ApnsCredential apnsCredential() { - return this.apnsCredential; - } - - /** - * Set the apnsCredential property: The ApnsCredential of the created NotificationHub. - * - * @param apnsCredential the apnsCredential value to set. - * @return the PnsCredentialsProperties object itself. - */ - public PnsCredentialsProperties withApnsCredential(ApnsCredential apnsCredential) { - this.apnsCredential = apnsCredential; - return this; - } - - /** - * Get the wnsCredential property: The WnsCredential of the created NotificationHub. - * - * @return the wnsCredential value. - */ - public WnsCredential wnsCredential() { - return this.wnsCredential; - } - - /** - * Set the wnsCredential property: The WnsCredential of the created NotificationHub. - * - * @param wnsCredential the wnsCredential value to set. - * @return the PnsCredentialsProperties object itself. - */ - public PnsCredentialsProperties withWnsCredential(WnsCredential wnsCredential) { - this.wnsCredential = wnsCredential; - return this; - } - - /** - * Get the gcmCredential property: The GcmCredential of the created NotificationHub. - * - * @return the gcmCredential value. - */ - public GcmCredential gcmCredential() { - return this.gcmCredential; - } - - /** - * Set the gcmCredential property: The GcmCredential of the created NotificationHub. - * - * @param gcmCredential the gcmCredential value to set. - * @return the PnsCredentialsProperties object itself. - */ - public PnsCredentialsProperties withGcmCredential(GcmCredential gcmCredential) { - this.gcmCredential = gcmCredential; - return this; - } - - /** - * Get the mpnsCredential property: The MpnsCredential of the created NotificationHub. - * - * @return the mpnsCredential value. - */ - public MpnsCredential mpnsCredential() { - return this.mpnsCredential; - } - - /** - * Set the mpnsCredential property: The MpnsCredential of the created NotificationHub. - * - * @param mpnsCredential the mpnsCredential value to set. - * @return the PnsCredentialsProperties object itself. - */ - public PnsCredentialsProperties withMpnsCredential(MpnsCredential mpnsCredential) { - this.mpnsCredential = mpnsCredential; - return this; - } - - /** - * Get the admCredential property: The AdmCredential of the created NotificationHub. - * - * @return the admCredential value. - */ - public AdmCredential admCredential() { - return this.admCredential; - } - - /** - * Set the admCredential property: The AdmCredential of the created NotificationHub. - * - * @param admCredential the admCredential value to set. - * @return the PnsCredentialsProperties object itself. - */ - public PnsCredentialsProperties withAdmCredential(AdmCredential admCredential) { - this.admCredential = admCredential; - return this; - } - - /** - * Get the baiduCredential property: The BaiduCredential of the created NotificationHub. - * - * @return the baiduCredential value. - */ - public BaiduCredential baiduCredential() { - return this.baiduCredential; - } - - /** - * Set the baiduCredential property: The BaiduCredential of the created NotificationHub. - * - * @param baiduCredential the baiduCredential value to set. - * @return the PnsCredentialsProperties object itself. - */ - public PnsCredentialsProperties withBaiduCredential(BaiduCredential baiduCredential) { - this.baiduCredential = baiduCredential; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (apnsCredential() != null) { - apnsCredential().validate(); - } - if (wnsCredential() != null) { - wnsCredential().validate(); - } - if (gcmCredential() != null) { - gcmCredential().validate(); - } - if (mpnsCredential() != null) { - mpnsCredential().validate(); - } - if (admCredential() != null) { - admCredential().validate(); - } - if (baiduCredential() != null) { - baiduCredential().validate(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("apnsCredential", this.apnsCredential); - jsonWriter.writeJsonField("wnsCredential", this.wnsCredential); - jsonWriter.writeJsonField("gcmCredential", this.gcmCredential); - jsonWriter.writeJsonField("mpnsCredential", this.mpnsCredential); - jsonWriter.writeJsonField("admCredential", this.admCredential); - jsonWriter.writeJsonField("baiduCredential", this.baiduCredential); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PnsCredentialsProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PnsCredentialsProperties if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the PnsCredentialsProperties. - */ - public static PnsCredentialsProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - PnsCredentialsProperties deserializedPnsCredentialsProperties = new PnsCredentialsProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("apnsCredential".equals(fieldName)) { - deserializedPnsCredentialsProperties.apnsCredential = ApnsCredential.fromJson(reader); - } else if ("wnsCredential".equals(fieldName)) { - deserializedPnsCredentialsProperties.wnsCredential = WnsCredential.fromJson(reader); - } else if ("gcmCredential".equals(fieldName)) { - deserializedPnsCredentialsProperties.gcmCredential = GcmCredential.fromJson(reader); - } else if ("mpnsCredential".equals(fieldName)) { - deserializedPnsCredentialsProperties.mpnsCredential = MpnsCredential.fromJson(reader); - } else if ("admCredential".equals(fieldName)) { - deserializedPnsCredentialsProperties.admCredential = AdmCredential.fromJson(reader); - } else if ("baiduCredential".equals(fieldName)) { - deserializedPnsCredentialsProperties.baiduCredential = BaiduCredential.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedPnsCredentialsProperties; - }); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentialsResourceInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentialsResourceInner.java index ff265ea78fc2..7e49daa04e75 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentialsResourceInner.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PnsCredentialsResourceInner.java @@ -1,38 +1,53 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.notificationhubs.models.AdmCredential; import com.azure.resourcemanager.notificationhubs.models.ApnsCredential; import com.azure.resourcemanager.notificationhubs.models.BaiduCredential; +import com.azure.resourcemanager.notificationhubs.models.BrowserCredential; +import com.azure.resourcemanager.notificationhubs.models.FcmV1Credential; import com.azure.resourcemanager.notificationhubs.models.GcmCredential; import com.azure.resourcemanager.notificationhubs.models.MpnsCredential; -import com.azure.resourcemanager.notificationhubs.models.Sku; import com.azure.resourcemanager.notificationhubs.models.WnsCredential; +import com.azure.resourcemanager.notificationhubs.models.XiaomiCredential; import java.io.IOException; import java.util.Map; /** - * 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. */ -@Fluent -public final class PnsCredentialsResourceInner extends Resource { +@Immutable +public final class PnsCredentialsResourceInner extends ProxyResource { /* - * NotificationHub PNS Credentials. + * Collection of Notification Hub or Notification Hub Namespace PNS credentials. */ - private PnsCredentialsProperties innerProperties; + private PnsCredentials innerProperties; /* - * The sku of the created namespace + * Deprecated - only for compatibility. */ - private Sku sku; + private String location; + + /* + * Deprecated - only for compatibility. + */ + private Map tags; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; /* * The type of the resource. @@ -52,36 +67,43 @@ public final class PnsCredentialsResourceInner extends Resource { /** * Creates an instance of PnsCredentialsResourceInner class. */ - public PnsCredentialsResourceInner() { + private PnsCredentialsResourceInner() { } /** - * Get the innerProperties property: NotificationHub PNS Credentials. + * Get the innerProperties property: Collection of Notification Hub or Notification Hub Namespace PNS credentials. * * @return the innerProperties value. */ - private PnsCredentialsProperties innerProperties() { + private PnsCredentials innerProperties() { return this.innerProperties; } /** - * Get the sku property: The sku of the created namespace. + * Get the location property: Deprecated - only for compatibility. * - * @return the sku value. + * @return the location value. */ - public Sku sku() { - return this.sku; + public String location() { + return this.location; } /** - * Set the sku property: The sku of the created namespace. + * Get the tags property: Deprecated - only for compatibility. * - * @param sku the sku value to set. - * @return the PnsCredentialsResourceInner object itself. + * @return the tags value. */ - public PnsCredentialsResourceInner withSku(Sku sku) { - this.sku = sku; - return this; + public Map tags() { + return this.tags; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; } /** @@ -115,25 +137,16 @@ public String id() { } /** - * {@inheritDoc} - */ - @Override - public PnsCredentialsResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} + * Get the admCredential property: Description of a NotificationHub AdmCredential. + * + * @return the admCredential value. */ - @Override - public PnsCredentialsResourceInner withTags(Map tags) { - super.withTags(tags); - return this; + public AdmCredential admCredential() { + return this.innerProperties() == null ? null : this.innerProperties().admCredential(); } /** - * Get the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Get the apnsCredential property: Description of a NotificationHub ApnsCredential. * * @return the apnsCredential value. */ @@ -142,44 +155,25 @@ public ApnsCredential apnsCredential() { } /** - * Set the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Get the baiduCredential property: Description of a NotificationHub BaiduCredential. * - * @param apnsCredential the apnsCredential value to set. - * @return the PnsCredentialsResourceInner object itself. - */ - public PnsCredentialsResourceInner withApnsCredential(ApnsCredential apnsCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new PnsCredentialsProperties(); - } - this.innerProperties().withApnsCredential(apnsCredential); - return this; - } - - /** - * Get the wnsCredential property: The WnsCredential of the created NotificationHub. - * - * @return the wnsCredential value. + * @return the baiduCredential value. */ - public WnsCredential wnsCredential() { - return this.innerProperties() == null ? null : this.innerProperties().wnsCredential(); + public BaiduCredential baiduCredential() { + return this.innerProperties() == null ? null : this.innerProperties().baiduCredential(); } /** - * Set the wnsCredential property: The WnsCredential of the created NotificationHub. + * Get the browserCredential property: Description of a NotificationHub BrowserCredential. * - * @param wnsCredential the wnsCredential value to set. - * @return the PnsCredentialsResourceInner object itself. + * @return the browserCredential value. */ - public PnsCredentialsResourceInner withWnsCredential(WnsCredential wnsCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new PnsCredentialsProperties(); - } - this.innerProperties().withWnsCredential(wnsCredential); - return this; + public BrowserCredential browserCredential() { + return this.innerProperties() == null ? null : this.innerProperties().browserCredential(); } /** - * Get the gcmCredential property: The GcmCredential of the created NotificationHub. + * Get the gcmCredential property: Description of a NotificationHub GcmCredential. * * @return the gcmCredential value. */ @@ -188,21 +182,7 @@ public GcmCredential gcmCredential() { } /** - * Set the gcmCredential property: The GcmCredential of the created NotificationHub. - * - * @param gcmCredential the gcmCredential value to set. - * @return the PnsCredentialsResourceInner object itself. - */ - public PnsCredentialsResourceInner withGcmCredential(GcmCredential gcmCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new PnsCredentialsProperties(); - } - this.innerProperties().withGcmCredential(gcmCredential); - return this; - } - - /** - * Get the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Get the mpnsCredential property: Description of a NotificationHub MpnsCredential. * * @return the mpnsCredential value. */ @@ -211,63 +191,30 @@ public MpnsCredential mpnsCredential() { } /** - * Set the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Get the wnsCredential property: Description of a NotificationHub WnsCredential. * - * @param mpnsCredential the mpnsCredential value to set. - * @return the PnsCredentialsResourceInner object itself. - */ - public PnsCredentialsResourceInner withMpnsCredential(MpnsCredential mpnsCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new PnsCredentialsProperties(); - } - this.innerProperties().withMpnsCredential(mpnsCredential); - return this; - } - - /** - * Get the admCredential property: The AdmCredential of the created NotificationHub. - * - * @return the admCredential value. - */ - public AdmCredential admCredential() { - return this.innerProperties() == null ? null : this.innerProperties().admCredential(); - } - - /** - * Set the admCredential property: The AdmCredential of the created NotificationHub. - * - * @param admCredential the admCredential value to set. - * @return the PnsCredentialsResourceInner object itself. + * @return the wnsCredential value. */ - public PnsCredentialsResourceInner withAdmCredential(AdmCredential admCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new PnsCredentialsProperties(); - } - this.innerProperties().withAdmCredential(admCredential); - return this; + public WnsCredential wnsCredential() { + return this.innerProperties() == null ? null : this.innerProperties().wnsCredential(); } /** - * Get the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Get the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. * - * @return the baiduCredential value. + * @return the xiaomiCredential value. */ - public BaiduCredential baiduCredential() { - return this.innerProperties() == null ? null : this.innerProperties().baiduCredential(); + public XiaomiCredential xiaomiCredential() { + return this.innerProperties() == null ? null : this.innerProperties().xiaomiCredential(); } /** - * Set the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Get the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. * - * @param baiduCredential the baiduCredential value to set. - * @return the PnsCredentialsResourceInner object itself. + * @return the fcmV1Credential value. */ - public PnsCredentialsResourceInner withBaiduCredential(BaiduCredential baiduCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new PnsCredentialsProperties(); - } - this.innerProperties().withBaiduCredential(baiduCredential); - return this; + public FcmV1Credential fcmV1Credential() { + return this.innerProperties() == null ? null : this.innerProperties().fcmV1Credential(); } /** @@ -279,9 +226,6 @@ public void validate() { if (innerProperties() != null) { innerProperties().validate(); } - if (sku() != null) { - sku().validate(); - } } /** @@ -290,10 +234,9 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); return jsonWriter.writeEndObject(); } @@ -319,15 +262,15 @@ public static PnsCredentialsResourceInner fromJson(JsonReader jsonReader) throws deserializedPnsCredentialsResourceInner.name = reader.getString(); } else if ("type".equals(fieldName)) { deserializedPnsCredentialsResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPnsCredentialsResourceInner.innerProperties = PnsCredentials.fromJson(reader); } else if ("location".equals(fieldName)) { - deserializedPnsCredentialsResourceInner.withLocation(reader.getString()); + deserializedPnsCredentialsResourceInner.location = reader.getString(); } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedPnsCredentialsResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedPnsCredentialsResourceInner.innerProperties = PnsCredentialsProperties.fromJson(reader); - } else if ("sku".equals(fieldName)) { - deserializedPnsCredentialsResourceInner.sku = Sku.fromJson(reader); + deserializedPnsCredentialsResourceInner.tags = tags; + } else if ("systemData".equals(fieldName)) { + deserializedPnsCredentialsResourceInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PrivateEndpointConnectionResourceInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PrivateEndpointConnectionResourceInner.java new file mode 100644 index 000000000000..fb4446e3a127 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PrivateEndpointConnectionResourceInner.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.models.PrivateEndpointConnectionProperties; +import java.io.IOException; + +/** + * Represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ +@Fluent +public final class PrivateEndpointConnectionResourceInner extends ProxyResource { + /* + * Private Endpoint Connection properties. + */ + private PrivateEndpointConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateEndpointConnectionResourceInner class. + */ + public PrivateEndpointConnectionResourceInner() { + } + + /** + * Get the properties property: Private Endpoint Connection properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Private Endpoint Connection properties. + * + * @param properties the properties value to set. + * @return the PrivateEndpointConnectionResourceInner object itself. + */ + public PrivateEndpointConnectionResourceInner withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionResourceInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionResourceInner. + */ + public static PrivateEndpointConnectionResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionResourceInner deserializedPrivateEndpointConnectionResourceInner + = new PrivateEndpointConnectionResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.properties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionResourceInner; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PrivateLinkResourceInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 000000000000..716763c05bef --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.models.PrivateLinkResourceProperties; +import java.io.IOException; + +/** + * A Private Link Arm Resource. + */ +@Immutable +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * Represents properties of Private Link Resource. + */ + private PrivateLinkResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateLinkResourceInner class. + */ + private PrivateLinkResourceInner() { + } + + /** + * Get the properties property: Represents properties of Private Link Resource. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateLinkResourceInner. + */ + public static PrivateLinkResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceInner deserializedPrivateLinkResourceInner = new PrivateLinkResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateLinkResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateLinkResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateLinkResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateLinkResourceInner.properties = PrivateLinkResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateLinkResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceInner; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/ResourceListKeysInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/ResourceListKeysInner.java index 27081da1f65f..3d0006081f1e 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/ResourceListKeysInner.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/ResourceListKeysInner.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -12,43 +12,44 @@ import java.io.IOException; /** - * Namespace/NotificationHub Connection String. + * Response for the POST request that returns Namespace or NotificationHub access keys (connection strings). */ -@Fluent +@Immutable public final class ResourceListKeysInner implements JsonSerializable { /* - * PrimaryConnectionString of the AuthorizationRule. + * Gets or sets primaryConnectionString of the AuthorizationRule. */ private String primaryConnectionString; /* - * SecondaryConnectionString of the created AuthorizationRule + * Gets or sets secondaryConnectionString of the created + * AuthorizationRule */ private String secondaryConnectionString; /* - * PrimaryKey of the created AuthorizationRule. + * Gets or sets primaryKey of the created AuthorizationRule. */ private String primaryKey; /* - * SecondaryKey of the created AuthorizationRule + * Gets or sets secondaryKey of the created AuthorizationRule */ private String secondaryKey; /* - * KeyName of the created AuthorizationRule + * Gets or sets keyName of the created AuthorizationRule */ private String keyName; /** * Creates an instance of ResourceListKeysInner class. */ - public ResourceListKeysInner() { + private ResourceListKeysInner() { } /** - * Get the primaryConnectionString property: PrimaryConnectionString of the AuthorizationRule. + * Get the primaryConnectionString property: Gets or sets primaryConnectionString of the AuthorizationRule. * * @return the primaryConnectionString value. */ @@ -57,18 +58,8 @@ public String primaryConnectionString() { } /** - * Set the primaryConnectionString property: PrimaryConnectionString of the AuthorizationRule. - * - * @param primaryConnectionString the primaryConnectionString value to set. - * @return the ResourceListKeysInner object itself. - */ - public ResourceListKeysInner withPrimaryConnectionString(String primaryConnectionString) { - this.primaryConnectionString = primaryConnectionString; - return this; - } - - /** - * Get the secondaryConnectionString property: SecondaryConnectionString of the created AuthorizationRule. + * Get the secondaryConnectionString property: Gets or sets secondaryConnectionString of the created + * AuthorizationRule. * * @return the secondaryConnectionString value. */ @@ -77,18 +68,7 @@ public String secondaryConnectionString() { } /** - * Set the secondaryConnectionString property: SecondaryConnectionString of the created AuthorizationRule. - * - * @param secondaryConnectionString the secondaryConnectionString value to set. - * @return the ResourceListKeysInner object itself. - */ - public ResourceListKeysInner withSecondaryConnectionString(String secondaryConnectionString) { - this.secondaryConnectionString = secondaryConnectionString; - return this; - } - - /** - * Get the primaryKey property: PrimaryKey of the created AuthorizationRule. + * Get the primaryKey property: Gets or sets primaryKey of the created AuthorizationRule. * * @return the primaryKey value. */ @@ -97,18 +77,7 @@ public String primaryKey() { } /** - * Set the primaryKey property: PrimaryKey of the created AuthorizationRule. - * - * @param primaryKey the primaryKey value to set. - * @return the ResourceListKeysInner object itself. - */ - public ResourceListKeysInner withPrimaryKey(String primaryKey) { - this.primaryKey = primaryKey; - return this; - } - - /** - * Get the secondaryKey property: SecondaryKey of the created AuthorizationRule. + * Get the secondaryKey property: Gets or sets secondaryKey of the created AuthorizationRule. * * @return the secondaryKey value. */ @@ -117,18 +86,7 @@ public String secondaryKey() { } /** - * Set the secondaryKey property: SecondaryKey of the created AuthorizationRule. - * - * @param secondaryKey the secondaryKey value to set. - * @return the ResourceListKeysInner object itself. - */ - public ResourceListKeysInner withSecondaryKey(String secondaryKey) { - this.secondaryKey = secondaryKey; - return this; - } - - /** - * Get the keyName property: KeyName of the created AuthorizationRule. + * Get the keyName property: Gets or sets keyName of the created AuthorizationRule. * * @return the keyName value. */ @@ -136,17 +94,6 @@ public String keyName() { return this.keyName; } - /** - * Set the keyName property: KeyName of the created AuthorizationRule. - * - * @param keyName the keyName value to set. - * @return the ResourceListKeysInner object itself. - */ - public ResourceListKeysInner withKeyName(String keyName) { - this.keyName = keyName; - return this; - } - /** * Validates the instance. * @@ -161,11 +108,6 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("primaryConnectionString", this.primaryConnectionString); - jsonWriter.writeStringField("secondaryConnectionString", this.secondaryConnectionString); - jsonWriter.writeStringField("primaryKey", this.primaryKey); - jsonWriter.writeStringField("secondaryKey", this.secondaryKey); - jsonWriter.writeStringField("keyName", this.keyName); return jsonWriter.writeEndObject(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/SharedAccessAuthorizationRuleProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/SharedAccessAuthorizationRuleProperties.java index 6eab471b9009..55c09bd1a421 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/SharedAccessAuthorizationRuleProperties.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/SharedAccessAuthorizationRuleProperties.java @@ -1,16 +1,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.notificationhubs.models.AccessRights; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.List; /** @@ -20,47 +23,49 @@ public final class SharedAccessAuthorizationRuleProperties implements JsonSerializable { /* - * The rights associated with the rule. + * Gets or sets the rights associated with the rule. */ private List rights; /* - * 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. */ private String primaryKey; /* - * 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. */ private String secondaryKey; /* - * A string that describes the authorization rule. + * Gets a string that describes the authorization rule. */ private String keyName; /* - * A string that describes the claim type + * Gets the last modified time for this rule */ - private String claimType; + private OffsetDateTime modifiedTime; /* - * A string that describes the claim value + * Gets the created time for this rule */ - private String claimValue; + private OffsetDateTime createdTime; /* - * The last modified time for this rule + * Gets a string that describes the claim type */ - private String modifiedTime; + private String claimType; /* - * The created time for this rule + * Gets a string that describes the claim value */ - private String createdTime; + private String claimValue; /* - * The revision number for the rule + * Gets the revision number for the rule */ private Integer revision; @@ -71,7 +76,7 @@ public SharedAccessAuthorizationRuleProperties() { } /** - * Get the rights property: The rights associated with the rule. + * Get the rights property: Gets or sets the rights associated with the rule. * * @return the rights value. */ @@ -80,7 +85,7 @@ public List rights() { } /** - * Set the rights property: The rights associated with the rule. + * Set the rights property: Gets or sets the rights associated with the rule. * * @param rights the rights value to set. * @return the SharedAccessAuthorizationRuleProperties object itself. @@ -91,7 +96,8 @@ public SharedAccessAuthorizationRuleProperties withRights(List rig } /** - * Get the primaryKey property: A base64-encoded 256-bit primary key for signing and validating the SAS token. + * Get the primaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. * * @return the primaryKey value. */ @@ -100,7 +106,20 @@ public String primaryKey() { } /** - * Get the secondaryKey property: A base64-encoded 256-bit primary key for signing and validating the SAS token. + * Set the primaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. + * + * @param primaryKey the primaryKey value to set. + * @return the SharedAccessAuthorizationRuleProperties object itself. + */ + public SharedAccessAuthorizationRuleProperties withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get the secondaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. * * @return the secondaryKey value. */ @@ -109,7 +128,19 @@ public String secondaryKey() { } /** - * Get the keyName property: A string that describes the authorization rule. + * Set the secondaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. + * + * @param secondaryKey the secondaryKey value to set. + * @return the SharedAccessAuthorizationRuleProperties object itself. + */ + public SharedAccessAuthorizationRuleProperties withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get the keyName property: Gets a string that describes the authorization rule. * * @return the keyName value. */ @@ -118,43 +149,43 @@ public String keyName() { } /** - * Get the claimType property: A string that describes the claim type. + * Get the modifiedTime property: Gets the last modified time for this rule. * - * @return the claimType value. + * @return the modifiedTime value. */ - public String claimType() { - return this.claimType; + public OffsetDateTime modifiedTime() { + return this.modifiedTime; } /** - * Get the claimValue property: A string that describes the claim value. + * Get the createdTime property: Gets the created time for this rule. * - * @return the claimValue value. + * @return the createdTime value. */ - public String claimValue() { - return this.claimValue; + public OffsetDateTime createdTime() { + return this.createdTime; } /** - * Get the modifiedTime property: The last modified time for this rule. + * Get the claimType property: Gets a string that describes the claim type. * - * @return the modifiedTime value. + * @return the claimType value. */ - public String modifiedTime() { - return this.modifiedTime; + public String claimType() { + return this.claimType; } /** - * Get the createdTime property: The created time for this rule. + * Get the claimValue property: Gets a string that describes the claim value. * - * @return the createdTime value. + * @return the claimValue value. */ - public String createdTime() { - return this.createdTime; + public String claimValue() { + return this.claimValue; } /** - * Get the revision property: The revision number for the rule. + * Get the revision property: Gets the revision number for the rule. * * @return the revision value. */ @@ -168,8 +199,15 @@ public Integer revision() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (rights() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property rights in model SharedAccessAuthorizationRuleProperties")); + } } + private static final ClientLogger LOGGER = new ClientLogger(SharedAccessAuthorizationRuleProperties.class); + /** * {@inheritDoc} */ @@ -178,6 +216,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeArrayField("rights", this.rights, (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("primaryKey", this.primaryKey); + jsonWriter.writeStringField("secondaryKey", this.secondaryKey); return jsonWriter.writeEndObject(); } @@ -187,6 +227,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of SharedAccessAuthorizationRuleProperties if the JsonReader was pointing to an instance of * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the SharedAccessAuthorizationRuleProperties. */ public static SharedAccessAuthorizationRuleProperties fromJson(JsonReader jsonReader) throws IOException { @@ -207,14 +248,16 @@ public static SharedAccessAuthorizationRuleProperties fromJson(JsonReader jsonRe deserializedSharedAccessAuthorizationRuleProperties.secondaryKey = reader.getString(); } else if ("keyName".equals(fieldName)) { deserializedSharedAccessAuthorizationRuleProperties.keyName = reader.getString(); + } else if ("modifiedTime".equals(fieldName)) { + deserializedSharedAccessAuthorizationRuleProperties.modifiedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdTime".equals(fieldName)) { + deserializedSharedAccessAuthorizationRuleProperties.createdTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("claimType".equals(fieldName)) { deserializedSharedAccessAuthorizationRuleProperties.claimType = reader.getString(); } else if ("claimValue".equals(fieldName)) { deserializedSharedAccessAuthorizationRuleProperties.claimValue = reader.getString(); - } else if ("modifiedTime".equals(fieldName)) { - deserializedSharedAccessAuthorizationRuleProperties.modifiedTime = reader.getString(); - } else if ("createdTime".equals(fieldName)) { - deserializedSharedAccessAuthorizationRuleProperties.createdTime = reader.getString(); } else if ("revision".equals(fieldName)) { deserializedSharedAccessAuthorizationRuleProperties.revision = reader.getNullable(JsonReader::getInt); diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/SharedAccessAuthorizationRuleResourceInner.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/SharedAccessAuthorizationRuleResourceInner.java index 0e7fd83c4703..4d2e1dcc50d4 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/SharedAccessAuthorizationRuleResourceInner.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/SharedAccessAuthorizationRuleResourceInner.java @@ -1,34 +1,45 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.notificationhubs.models.AccessRights; -import com.azure.resourcemanager.notificationhubs.models.Sku; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.List; import java.util.Map; /** - * Description of a Namespace AuthorizationRules. + * Response for POST requests that return single SharedAccessAuthorizationRule. */ @Fluent -public final class SharedAccessAuthorizationRuleResourceInner extends Resource { +public final class SharedAccessAuthorizationRuleResourceInner extends ProxyResource { /* - * Properties of the Namespace AuthorizationRule. + * SharedAccessAuthorizationRule properties. */ private SharedAccessAuthorizationRuleProperties innerProperties; /* - * The sku of the created namespace + * The location property. */ - private Sku sku; + private String location; + + /* + * The tags property. + */ + private Map tags; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; /* * The type of the resource. @@ -52,7 +63,7 @@ public SharedAccessAuthorizationRuleResourceInner() { } /** - * Get the innerProperties property: Properties of the Namespace AuthorizationRule. + * Get the innerProperties property: SharedAccessAuthorizationRule properties. * * @return the innerProperties value. */ @@ -61,25 +72,54 @@ private SharedAccessAuthorizationRuleProperties innerProperties() { } /** - * Get the sku property: The sku of the created namespace. + * Get the location property: The location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location property. * - * @return the sku value. + * @param location the location value to set. + * @return the SharedAccessAuthorizationRuleResourceInner object itself. */ - public Sku sku() { - return this.sku; + public SharedAccessAuthorizationRuleResourceInner withLocation(String location) { + this.location = location; + return this; } /** - * Set the sku property: The sku of the created namespace. + * Get the tags property: The tags property. * - * @param sku the sku value to set. + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags property. + * + * @param tags the tags value to set. * @return the SharedAccessAuthorizationRuleResourceInner object itself. */ - public SharedAccessAuthorizationRuleResourceInner withSku(Sku sku) { - this.sku = sku; + public SharedAccessAuthorizationRuleResourceInner withTags(Map tags) { + this.tags = tags; return this; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the type property: The type of the resource. * @@ -111,25 +151,7 @@ public String id() { } /** - * {@inheritDoc} - */ - @Override - public SharedAccessAuthorizationRuleResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public SharedAccessAuthorizationRuleResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the rights property: The rights associated with the rule. + * Get the rights property: Gets or sets the rights associated with the rule. * * @return the rights value. */ @@ -138,7 +160,7 @@ public List rights() { } /** - * Set the rights property: The rights associated with the rule. + * Set the rights property: Gets or sets the rights associated with the rule. * * @param rights the rights value to set. * @return the SharedAccessAuthorizationRuleResourceInner object itself. @@ -152,7 +174,8 @@ public SharedAccessAuthorizationRuleResourceInner withRights(List } /** - * Get the primaryKey property: A base64-encoded 256-bit primary key for signing and validating the SAS token. + * Get the primaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. * * @return the primaryKey value. */ @@ -161,7 +184,23 @@ public String primaryKey() { } /** - * Get the secondaryKey property: A base64-encoded 256-bit primary key for signing and validating the SAS token. + * Set the primaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. + * + * @param primaryKey the primaryKey value to set. + * @return the SharedAccessAuthorizationRuleResourceInner object itself. + */ + public SharedAccessAuthorizationRuleResourceInner withPrimaryKey(String primaryKey) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedAccessAuthorizationRuleProperties(); + } + this.innerProperties().withPrimaryKey(primaryKey); + return this; + } + + /** + * Get the secondaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. * * @return the secondaryKey value. */ @@ -170,7 +209,22 @@ public String secondaryKey() { } /** - * Get the keyName property: A string that describes the authorization rule. + * Set the secondaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. + * + * @param secondaryKey the secondaryKey value to set. + * @return the SharedAccessAuthorizationRuleResourceInner object itself. + */ + public SharedAccessAuthorizationRuleResourceInner withSecondaryKey(String secondaryKey) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedAccessAuthorizationRuleProperties(); + } + this.innerProperties().withSecondaryKey(secondaryKey); + return this; + } + + /** + * Get the keyName property: Gets a string that describes the authorization rule. * * @return the keyName value. */ @@ -179,43 +233,43 @@ public String keyName() { } /** - * Get the claimType property: A string that describes the claim type. + * Get the modifiedTime property: Gets the last modified time for this rule. * - * @return the claimType value. + * @return the modifiedTime value. */ - public String claimType() { - return this.innerProperties() == null ? null : this.innerProperties().claimType(); + public OffsetDateTime modifiedTime() { + return this.innerProperties() == null ? null : this.innerProperties().modifiedTime(); } /** - * Get the claimValue property: A string that describes the claim value. + * Get the createdTime property: Gets the created time for this rule. * - * @return the claimValue value. + * @return the createdTime value. */ - public String claimValue() { - return this.innerProperties() == null ? null : this.innerProperties().claimValue(); + public OffsetDateTime createdTime() { + return this.innerProperties() == null ? null : this.innerProperties().createdTime(); } /** - * Get the modifiedTime property: The last modified time for this rule. + * Get the claimType property: Gets a string that describes the claim type. * - * @return the modifiedTime value. + * @return the claimType value. */ - public String modifiedTime() { - return this.innerProperties() == null ? null : this.innerProperties().modifiedTime(); + public String claimType() { + return this.innerProperties() == null ? null : this.innerProperties().claimType(); } /** - * Get the createdTime property: The created time for this rule. + * Get the claimValue property: Gets a string that describes the claim value. * - * @return the createdTime value. + * @return the claimValue value. */ - public String createdTime() { - return this.innerProperties() == null ? null : this.innerProperties().createdTime(); + public String claimValue() { + return this.innerProperties() == null ? null : this.innerProperties().claimValue(); } /** - * Get the revision property: The revision number for the rule. + * Get the revision property: Gets the revision number for the rule. * * @return the revision value. */ @@ -232,9 +286,6 @@ public void validate() { if (innerProperties() != null) { innerProperties().validate(); } - if (sku() != null) { - sku().validate(); - } } /** @@ -243,10 +294,9 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); return jsonWriter.writeEndObject(); } @@ -273,16 +323,16 @@ public static SharedAccessAuthorizationRuleResourceInner fromJson(JsonReader jso deserializedSharedAccessAuthorizationRuleResourceInner.name = reader.getString(); } else if ("type".equals(fieldName)) { deserializedSharedAccessAuthorizationRuleResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedSharedAccessAuthorizationRuleResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedSharedAccessAuthorizationRuleResourceInner.withTags(tags); } else if ("properties".equals(fieldName)) { deserializedSharedAccessAuthorizationRuleResourceInner.innerProperties = SharedAccessAuthorizationRuleProperties.fromJson(reader); - } else if ("sku".equals(fieldName)) { - deserializedSharedAccessAuthorizationRuleResourceInner.sku = Sku.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedSharedAccessAuthorizationRuleResourceInner.location = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSharedAccessAuthorizationRuleResourceInner.tags = tags; + } else if ("systemData".equals(fieldName)) { + deserializedSharedAccessAuthorizationRuleResourceInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/WnsCredentialProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/WnsCredentialProperties.java index fa42ceb01832..be2805197695 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/WnsCredentialProperties.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/WnsCredentialProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.fluent.models; @@ -17,20 +17,30 @@ @Fluent public final class WnsCredentialProperties implements JsonSerializable { /* - * The package ID for this credential. + * Gets or sets the package ID for this credential. */ private String packageSid; /* - * The secret key. + * Gets or sets the secret key. */ private String secretKey; /* - * The Windows Live endpoint. + * Gets or sets the Windows Live endpoint. */ private String windowsLiveEndpoint; + /* + * Ges or sets the WNS Certificate Key. + */ + private String certificateKey; + + /* + * Gets or sets the WNS Certificate. + */ + private String wnsCertificate; + /** * Creates an instance of WnsCredentialProperties class. */ @@ -38,7 +48,7 @@ public WnsCredentialProperties() { } /** - * Get the packageSid property: The package ID for this credential. + * Get the packageSid property: Gets or sets the package ID for this credential. * * @return the packageSid value. */ @@ -47,7 +57,7 @@ public String packageSid() { } /** - * Set the packageSid property: The package ID for this credential. + * Set the packageSid property: Gets or sets the package ID for this credential. * * @param packageSid the packageSid value to set. * @return the WnsCredentialProperties object itself. @@ -58,7 +68,7 @@ public WnsCredentialProperties withPackageSid(String packageSid) { } /** - * Get the secretKey property: The secret key. + * Get the secretKey property: Gets or sets the secret key. * * @return the secretKey value. */ @@ -67,7 +77,7 @@ public String secretKey() { } /** - * Set the secretKey property: The secret key. + * Set the secretKey property: Gets or sets the secret key. * * @param secretKey the secretKey value to set. * @return the WnsCredentialProperties object itself. @@ -78,7 +88,7 @@ public WnsCredentialProperties withSecretKey(String secretKey) { } /** - * Get the windowsLiveEndpoint property: The Windows Live endpoint. + * Get the windowsLiveEndpoint property: Gets or sets the Windows Live endpoint. * * @return the windowsLiveEndpoint value. */ @@ -87,7 +97,7 @@ public String windowsLiveEndpoint() { } /** - * Set the windowsLiveEndpoint property: The Windows Live endpoint. + * Set the windowsLiveEndpoint property: Gets or sets the Windows Live endpoint. * * @param windowsLiveEndpoint the windowsLiveEndpoint value to set. * @return the WnsCredentialProperties object itself. @@ -97,6 +107,46 @@ public WnsCredentialProperties withWindowsLiveEndpoint(String windowsLiveEndpoin return this; } + /** + * Get the certificateKey property: Ges or sets the WNS Certificate Key. + * + * @return the certificateKey value. + */ + public String certificateKey() { + return this.certificateKey; + } + + /** + * Set the certificateKey property: Ges or sets the WNS Certificate Key. + * + * @param certificateKey the certificateKey value to set. + * @return the WnsCredentialProperties object itself. + */ + public WnsCredentialProperties withCertificateKey(String certificateKey) { + this.certificateKey = certificateKey; + return this; + } + + /** + * Get the wnsCertificate property: Gets or sets the WNS Certificate. + * + * @return the wnsCertificate value. + */ + public String wnsCertificate() { + return this.wnsCertificate; + } + + /** + * Set the wnsCertificate property: Gets or sets the WNS Certificate. + * + * @param wnsCertificate the wnsCertificate value to set. + * @return the WnsCredentialProperties object itself. + */ + public WnsCredentialProperties withWnsCertificate(String wnsCertificate) { + this.wnsCertificate = wnsCertificate; + return this; + } + /** * Validates the instance. * @@ -114,6 +164,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("packageSid", this.packageSid); jsonWriter.writeStringField("secretKey", this.secretKey); jsonWriter.writeStringField("windowsLiveEndpoint", this.windowsLiveEndpoint); + jsonWriter.writeStringField("certificateKey", this.certificateKey); + jsonWriter.writeStringField("wnsCertificate", this.wnsCertificate); return jsonWriter.writeEndObject(); } @@ -138,6 +190,10 @@ public static WnsCredentialProperties fromJson(JsonReader jsonReader) throws IOE deserializedWnsCredentialProperties.secretKey = reader.getString(); } else if ("windowsLiveEndpoint".equals(fieldName)) { deserializedWnsCredentialProperties.windowsLiveEndpoint = reader.getString(); + } else if ("certificateKey".equals(fieldName)) { + deserializedWnsCredentialProperties.certificateKey = reader.getString(); + } else if ("wnsCertificate".equals(fieldName)) { + deserializedWnsCredentialProperties.wnsCertificate = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/XiaomiCredentialProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/XiaomiCredentialProperties.java new file mode 100644 index 000000000000..ef18bb54f183 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/XiaomiCredentialProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Description of a NotificationHub XiaomiCredentialProperties. + */ +@Fluent +public final class XiaomiCredentialProperties implements JsonSerializable { + /* + * Gets or sets app secret. + */ + private String appSecret; + + /* + * Gets or sets xiaomi service endpoint. + */ + private String endpoint; + + /** + * Creates an instance of XiaomiCredentialProperties class. + */ + public XiaomiCredentialProperties() { + } + + /** + * Get the appSecret property: Gets or sets app secret. + * + * @return the appSecret value. + */ + public String appSecret() { + return this.appSecret; + } + + /** + * Set the appSecret property: Gets or sets app secret. + * + * @param appSecret the appSecret value to set. + * @return the XiaomiCredentialProperties object itself. + */ + public XiaomiCredentialProperties withAppSecret(String appSecret) { + this.appSecret = appSecret; + return this; + } + + /** + * Get the endpoint property: Gets or sets xiaomi service endpoint. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint property: Gets or sets xiaomi service endpoint. + * + * @param endpoint the endpoint value to set. + * @return the XiaomiCredentialProperties object itself. + */ + public XiaomiCredentialProperties withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("appSecret", this.appSecret); + jsonWriter.writeStringField("endpoint", this.endpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of XiaomiCredentialProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of XiaomiCredentialProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the XiaomiCredentialProperties. + */ + public static XiaomiCredentialProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + XiaomiCredentialProperties deserializedXiaomiCredentialProperties = new XiaomiCredentialProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("appSecret".equals(fieldName)) { + deserializedXiaomiCredentialProperties.appSecret = reader.getString(); + } else if ("endpoint".equals(fieldName)) { + deserializedXiaomiCredentialProperties.endpoint = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedXiaomiCredentialProperties; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/package-info.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/package-info.java index 0d52242c1586..dc3f1a465903 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/package-info.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the inner data models for NotificationHubsManagementClient. - * Azure NotificationHub client. + * Package containing the inner data models for Notificationhubs. + * Microsoft Notification Hubs Resource Provider REST API. */ package com.azure.resourcemanager.notificationhubs.fluent.models; diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/package-info.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/package-info.java index e734f00e5f36..c17f39e986dd 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/package-info.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/fluent/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the service clients for NotificationHubsManagementClient. - * Azure NotificationHub client. + * Package containing the service clients for Notificationhubs. + * Microsoft Notification Hubs Resource Provider REST API. */ package com.azure.resourcemanager.notificationhubs.fluent; diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/CheckAvailabilityResultImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/CheckAvailabilityResultImpl.java index 1a097162a300..092f4a952ccc 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/CheckAvailabilityResultImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/CheckAvailabilityResultImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityResult; import com.azure.resourcemanager.notificationhubs.models.Sku; @@ -13,10 +14,10 @@ public final class CheckAvailabilityResultImpl implements CheckAvailabilityResult { private CheckAvailabilityResultInner innerObject; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; CheckAvailabilityResultImpl(CheckAvailabilityResultInner innerObject, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -33,6 +34,10 @@ public String type() { return this.innerModel().type(); } + public Boolean isAvailiable() { + return this.innerModel().isAvailiable(); + } + public String location() { return this.innerModel().location(); } @@ -46,19 +51,19 @@ public Map tags() { } } - public Boolean isAvailiable() { - return this.innerModel().isAvailiable(); - } - public Sku sku() { return this.innerModel().sku(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public CheckAvailabilityResultInner innerModel() { return this.innerObject; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/DebugSendResponseImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/DebugSendResponseImpl.java index 1c876535aa63..d8632ce34bba 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/DebugSendResponseImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/DebugSendResponseImpl.java @@ -1,22 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner; import com.azure.resourcemanager.notificationhubs.models.DebugSendResponse; -import com.azure.resourcemanager.notificationhubs.models.Sku; +import com.azure.resourcemanager.notificationhubs.models.RegistrationResult; import java.util.Collections; +import java.util.List; import java.util.Map; public final class DebugSendResponseImpl implements DebugSendResponse { private DebugSendResponseInner innerObject; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; DebugSendResponseImpl(DebugSendResponseInner innerObject, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -46,27 +48,32 @@ public Map tags() { } } - public Sku sku() { - return this.innerModel().sku(); + public SystemData systemData() { + return this.innerModel().systemData(); } - public Float success() { + public Long success() { return this.innerModel().success(); } - public Float failure() { + public Long failure() { return this.innerModel().failure(); } - public Object results() { - return this.innerModel().results(); + public List results() { + List inner = this.innerModel().results(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } } public DebugSendResponseInner innerModel() { return this.innerObject; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourceImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourceImpl.java index 52e08bc7acfd..d1045d1ca5ba 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourceImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourceImpl.java @@ -1,26 +1,42 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; +import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceProperties; import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; -import com.azure.resourcemanager.notificationhubs.models.NamespaceCreateOrUpdateParameters; +import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentials; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityResult; import com.azure.resourcemanager.notificationhubs.models.NamespacePatchParameters; import com.azure.resourcemanager.notificationhubs.models.NamespaceResource; +import com.azure.resourcemanager.notificationhubs.models.NamespaceStatus; import com.azure.resourcemanager.notificationhubs.models.NamespaceType; +import com.azure.resourcemanager.notificationhubs.models.NetworkAcls; +import com.azure.resourcemanager.notificationhubs.models.OperationProvisioningState; +import com.azure.resourcemanager.notificationhubs.models.PnsCredentialsResource; +import com.azure.resourcemanager.notificationhubs.models.PrivateEndpointConnectionResource; +import com.azure.resourcemanager.notificationhubs.models.PublicNetworkAccess; +import com.azure.resourcemanager.notificationhubs.models.ReplicationRegion; import com.azure.resourcemanager.notificationhubs.models.Sku; +import com.azure.resourcemanager.notificationhubs.models.ZoneRedundancyPreference; import java.time.OffsetDateTime; import java.util.Collections; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public final class NamespaceResourceImpl implements NamespaceResource, NamespaceResource.Definition, NamespaceResource.Update { private NamespaceResourceInner innerObject; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; public String id() { return this.innerModel().id(); @@ -51,14 +67,34 @@ public Sku sku() { return this.innerModel().sku(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String namePropertiesName() { return this.innerModel().namePropertiesName(); } - public String provisioningState() { + public OperationProvisioningState provisioningState() { return this.innerModel().provisioningState(); } + public NamespaceStatus status() { + return this.innerModel().status(); + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public Boolean critical() { + return this.innerModel().critical(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + public String region() { return this.innerModel().region(); } @@ -67,10 +103,6 @@ public String metricId() { return this.innerModel().metricId(); } - public String status() { - return this.innerModel().status(); - } - public OffsetDateTime createdAt() { return this.innerModel().createdAt(); } @@ -79,32 +111,51 @@ public OffsetDateTime updatedAt() { return this.innerModel().updatedAt(); } - public String serviceBusEndpoint() { - return this.innerModel().serviceBusEndpoint(); + public NamespaceType namespaceType() { + return this.innerModel().namespaceType(); } - public String subscriptionId() { - return this.innerModel().subscriptionId(); + public ReplicationRegion replicationRegion() { + return this.innerModel().replicationRegion(); } - public String scaleUnit() { - return this.innerModel().scaleUnit(); + public ZoneRedundancyPreference zoneRedundancy() { + return this.innerModel().zoneRedundancy(); } - public Boolean enabled() { - return this.innerModel().enabled(); + public NetworkAcls networkAcls() { + return this.innerModel().networkAcls(); } - public Boolean critical() { - return this.innerModel().critical(); + public PnsCredentials pnsCredentials() { + return this.innerModel().pnsCredentials(); + } + + public String serviceBusEndpoint() { + return this.innerModel().serviceBusEndpoint(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner.stream() + .map(inner1 -> new PrivateEndpointConnectionResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String scaleUnit() { + return this.innerModel().scaleUnit(); } public String dataCenter() { return this.innerModel().dataCenter(); } - public NamespaceType namespaceType() { - return this.innerModel().namespaceType(); + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); } public String resourceGroupName() { @@ -115,7 +166,7 @@ public NamespaceResourceInner innerModel() { return this.innerObject; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } @@ -123,8 +174,6 @@ private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manag private String namespaceName; - private NamespaceCreateOrUpdateParameters createParameters; - private NamespacePatchParameters updateParameters; public NamespaceResourceImpl withExistingResourceGroup(String resourceGroupName) { @@ -134,26 +183,23 @@ public NamespaceResourceImpl withExistingResourceGroup(String resourceGroupName) public NamespaceResource create() { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .createOrUpdateWithResponse(resourceGroupName, namespaceName, createParameters, Context.NONE) - .getValue(); + .getNamespaceResources() + .createOrUpdate(resourceGroupName, namespaceName, this.innerModel(), Context.NONE); return this; } public NamespaceResource create(Context context) { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .createOrUpdateWithResponse(resourceGroupName, namespaceName, createParameters, context) - .getValue(); + .getNamespaceResources() + .createOrUpdate(resourceGroupName, namespaceName, this.innerModel(), context); return this; } NamespaceResourceImpl(String name, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = new NamespaceResourceInner(); this.serviceManager = serviceManager; this.namespaceName = name; - this.createParameters = new NamespaceCreateOrUpdateParameters(); } public NamespaceResourceImpl update() { @@ -163,22 +209,22 @@ public NamespaceResourceImpl update() { public NamespaceResource apply() { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .patchWithResponse(resourceGroupName, namespaceName, updateParameters, Context.NONE) + .getNamespaceResources() + .updateWithResponse(resourceGroupName, namespaceName, updateParameters, Context.NONE) .getValue(); return this; } public NamespaceResource apply(Context context) { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .patchWithResponse(resourceGroupName, namespaceName, updateParameters, context) + .getNamespaceResources() + .updateWithResponse(resourceGroupName, namespaceName, updateParameters, context) .getValue(); return this; } NamespaceResourceImpl(NamespaceResourceInner innerObject, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); @@ -187,7 +233,7 @@ public NamespaceResource apply(Context context) { public NamespaceResource refresh() { this.innerObject = serviceManager.serviceClient() - .getNamespaces() + .getNamespaceResources() .getByResourceGroupWithResponse(resourceGroupName, namespaceName, Context.NONE) .getValue(); return this; @@ -195,104 +241,114 @@ public NamespaceResource refresh() { public NamespaceResource refresh(Context context) { this.innerObject = serviceManager.serviceClient() - .getNamespaces() + .getNamespaceResources() .getByResourceGroupWithResponse(resourceGroupName, namespaceName, context) .getValue(); return this; } - public NamespaceResourceImpl withLocation(Region location) { - this.createParameters.withLocation(location.toString()); + public Response + checkNotificationHubAvailabilityWithResponse(CheckAvailabilityParameters parameters, Context context) { + return serviceManager.namespaceResources() + .checkNotificationHubAvailabilityWithResponse(resourceGroupName, namespaceName, parameters, context); + } + + public CheckAvailabilityResult checkNotificationHubAvailability(CheckAvailabilityParameters parameters) { + return serviceManager.namespaceResources() + .checkNotificationHubAvailability(resourceGroupName, namespaceName, parameters); + } + + public Response getPnsCredentialsWithResponse(Context context) { + return serviceManager.namespaceResources() + .getPnsCredentialsWithResponse(resourceGroupName, namespaceName, context); + } + + public PnsCredentialsResource getPnsCredentials() { + return serviceManager.namespaceResources().getPnsCredentials(resourceGroupName, namespaceName); + } + + public NamespaceResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); return this; } - public NamespaceResourceImpl withLocation(String location) { - this.createParameters.withLocation(location); + public NamespaceResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); return this; } - public NamespaceResourceImpl withTags(Map tags) { + public NamespaceResourceImpl withSku(Sku sku) { if (isInCreateMode()) { - this.createParameters.withTags(tags); + this.innerModel().withSku(sku); return this; } else { - this.updateParameters.withTags(tags); + this.updateParameters.withSku(sku); return this; } } - public NamespaceResourceImpl withSku(Sku sku) { + public NamespaceResourceImpl withTags(Map tags) { if (isInCreateMode()) { - this.createParameters.withSku(sku); + this.innerModel().withTags(tags); return this; } else { - this.updateParameters.withSku(sku); + this.updateParameters.withTags(tags); return this; } } - public NamespaceResourceImpl withNamePropertiesName(String namePropertiesName) { - this.createParameters.withNamePropertiesName(namePropertiesName); + public NamespaceResourceImpl withProvisioningState(OperationProvisioningState provisioningState) { + this.innerModel().withProvisioningState(provisioningState); return this; } - public NamespaceResourceImpl withProvisioningState(String provisioningState) { - this.createParameters.withProvisioningState(provisioningState); + public NamespaceResourceImpl withStatus(NamespaceStatus status) { + this.innerModel().withStatus(status); return this; } - public NamespaceResourceImpl withRegion(String region) { - this.createParameters.withRegion(region); - return this; - } - - public NamespaceResourceImpl withStatus(String status) { - this.createParameters.withStatus(status); + public NamespaceResourceImpl withNamespaceType(NamespaceType namespaceType) { + this.innerModel().withNamespaceType(namespaceType); return this; } - public NamespaceResourceImpl withCreatedAt(OffsetDateTime createdAt) { - this.createParameters.withCreatedAt(createdAt); + public NamespaceResourceImpl withReplicationRegion(ReplicationRegion replicationRegion) { + this.innerModel().withReplicationRegion(replicationRegion); return this; } - public NamespaceResourceImpl withUpdatedAt(OffsetDateTime updatedAt) { - this.createParameters.withUpdatedAt(updatedAt); + public NamespaceResourceImpl withZoneRedundancy(ZoneRedundancyPreference zoneRedundancy) { + this.innerModel().withZoneRedundancy(zoneRedundancy); return this; } - public NamespaceResourceImpl withServiceBusEndpoint(String serviceBusEndpoint) { - this.createParameters.withServiceBusEndpoint(serviceBusEndpoint); + public NamespaceResourceImpl withNetworkAcls(NetworkAcls networkAcls) { + this.innerModel().withNetworkAcls(networkAcls); return this; } - public NamespaceResourceImpl withSubscriptionId(String subscriptionId) { - this.createParameters.withSubscriptionId(subscriptionId); + public NamespaceResourceImpl withPnsCredentials(PnsCredentials pnsCredentials) { + this.innerModel().withPnsCredentials(pnsCredentials); return this; } public NamespaceResourceImpl withScaleUnit(String scaleUnit) { - this.createParameters.withScaleUnit(scaleUnit); + this.innerModel().withScaleUnit(scaleUnit); return this; } - public NamespaceResourceImpl withEnabled(Boolean enabled) { - this.createParameters.withEnabled(enabled); - return this; - } - - public NamespaceResourceImpl withCritical(Boolean critical) { - this.createParameters.withCritical(critical); + public NamespaceResourceImpl withDataCenter(String dataCenter) { + this.innerModel().withDataCenter(dataCenter); return this; } - public NamespaceResourceImpl withDataCenter(String dataCenter) { - this.createParameters.withDataCenter(dataCenter); + public NamespaceResourceImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); return this; } - public NamespaceResourceImpl withNamespaceType(NamespaceType namespaceType) { - this.createParameters.withNamespaceType(namespaceType); + public NamespaceResourceImpl withProperties(NamespaceProperties properties) { + this.updateParameters.withProperties(properties); return this; } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourcesClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourcesClientImpl.java new file mode 100644 index 000000000000..4e51a3660dd4 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourcesClientImpl.java @@ -0,0 +1,1557 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.notificationhubs.fluent.NamespaceResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; +import com.azure.resourcemanager.notificationhubs.implementation.models.NamespaceListResult; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; +import com.azure.resourcemanager.notificationhubs.models.NamespacePatchParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NamespaceResourcesClient. + */ +public final class NamespaceResourcesClientImpl implements NamespaceResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final NamespaceResourcesService service; + + /** + * The service client containing this operation class. + */ + private final NotificationHubsClientImpl client; + + /** + * Initializes an instance of NamespaceResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NamespaceResourcesClientImpl(NotificationHubsClientImpl client) { + this.service = RestProxy.create(NamespaceResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NotificationHubsClientNamespaceResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NotificationHubsClie") + public interface NamespaceResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NamespaceResourceInner parameters, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NamespaceResourceInner parameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NamespacePatchParameters parameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NamespacePatchParameters parameters, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("$skipToken") String skipToken, + @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("$skipToken") String skipToken, + @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$skipToken") String skipToken, @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$skipToken") String skipToken, @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNotificationHubAvailability( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckAvailabilityParameters parameters, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response checkNotificationHubAvailabilitySync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckAvailabilityParameters parameters, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/pnsCredentials") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getPnsCredentials(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/pnsCredentials") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getPnsCredentialsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns the given namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String namespaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the given namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, namespaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the given namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String namespaceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context); + } + + /** + * Returns the given namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NamespaceResourceInner getByResourceGroup(String resourceGroupName, String namespaceName) { + return getByResourceGroupWithResponse(resourceGroupName, namespaceName, Context.NONE).getValue(); + } + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String namespaceName, NamespaceResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, contentType, accept, parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String namespaceName, + NamespaceResourceInner parameters) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, contentType, accept, parameters, + Context.NONE); + } + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String namespaceName, + NamespaceResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, contentType, accept, parameters, + context); + } + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NamespaceResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String namespaceName, NamespaceResourceInner parameters) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, namespaceName, parameters); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NamespaceResourceInner.class, NamespaceResourceInner.class, + this.client.getContext()); + } + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NamespaceResourceInner> + beginCreateOrUpdate(String resourceGroupName, String namespaceName, NamespaceResourceInner parameters) { + Response response = createOrUpdateWithResponse(resourceGroupName, namespaceName, parameters); + return this.client.getLroResult(response, + NamespaceResourceInner.class, NamespaceResourceInner.class, Context.NONE); + } + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NamespaceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String namespaceName, NamespaceResourceInner parameters, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, namespaceName, parameters, context); + return this.client.getLroResult(response, + NamespaceResourceInner.class, NamespaceResourceInner.class, context); + } + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String namespaceName, + NamespaceResourceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, namespaceName, parameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NamespaceResourceInner createOrUpdate(String resourceGroupName, String namespaceName, + NamespaceResourceInner parameters) { + return beginCreateOrUpdate(resourceGroupName, namespaceName, parameters).getFinalResult(); + } + + /** + * Creates / Updates a Notification Hub namespace. This operation is idempotent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NamespaceResourceInner createOrUpdate(String resourceGroupName, String namespaceName, + NamespaceResourceInner parameters, Context context) { + return beginCreateOrUpdate(resourceGroupName, namespaceName, parameters, context).getFinalResult(); + } + + /** + * Patches the existing namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String namespaceName, NamespacePatchParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, contentType, accept, parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Patches the existing namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String namespaceName, + NamespacePatchParameters parameters) { + return updateWithResponseAsync(resourceGroupName, namespaceName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Patches the existing namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String namespaceName, + NamespacePatchParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, contentType, accept, parameters, + context); + } + + /** + * Patches the existing namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NamespaceResourceInner update(String resourceGroupName, String namespaceName, + NamespacePatchParameters parameters) { + return updateWithResponse(resourceGroupName, namespaceName, parameters, Context.NONE).getValue(); + } + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String namespaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String namespaceName) { + return deleteWithResponseAsync(resourceGroupName, namespaceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String namespaceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context); + } + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String namespaceName) { + deleteWithResponse(resourceGroupName, namespaceName, Context.NONE); + } + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + String skipToken, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, skipToken, top, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String skipToken, + Integer top) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, skipToken, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String skipToken = null; + final Integer top = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, skipToken, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + String skipToken, Integer top) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, skipToken, top, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + String skipToken, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, skipToken, top, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String skipToken = null; + final Integer top = null; + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, skipToken, top), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String skipToken, + Integer top, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, skipToken, top, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Lists all the available namespaces within the subscription. + * + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String skipToken, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), skipToken, top, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the available namespaces within the subscription. + * + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String skipToken, Integer top) { + return new PagedFlux<>(() -> listSinglePageAsync(skipToken, top), + nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the available namespaces within the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String skipToken = null; + final Integer top = null; + return new PagedFlux<>(() -> listSinglePageAsync(skipToken, top), + nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the available namespaces within the subscription. + * + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String skipToken, Integer top) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), skipToken, top, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all the available namespaces within the subscription. + * + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String skipToken, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), skipToken, top, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all the available namespaces within the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String skipToken = null; + final Integer top = null; + return new PagedIterable<>(() -> listSinglePage(skipToken, top), nextLink -> listAllNextSinglePage(nextLink)); + } + + /** + * Lists all the available namespaces within the subscription. + * + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String skipToken, Integer top, Context context) { + return new PagedIterable<>(() -> listSinglePage(skipToken, top, context), + nextLink -> listAllNextSinglePage(nextLink, context)); + } + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNotificationHubAvailabilityWithResponseAsync( + String resourceGroupName, String namespaceName, CheckAvailabilityParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkNotificationHubAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, namespaceName, + contentType, accept, parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNotificationHubAvailabilityAsync(String resourceGroupName, + String namespaceName, CheckAvailabilityParameters parameters) { + return checkNotificationHubAvailabilityWithResponseAsync(resourceGroupName, namespaceName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNotificationHubAvailabilityWithResponse(String resourceGroupName, + String namespaceName, CheckAvailabilityParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.checkNotificationHubAvailabilitySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, contentType, accept, parameters, + context); + } + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckAvailabilityResultInner checkNotificationHubAvailability(String resourceGroupName, String namespaceName, + CheckAvailabilityParameters parameters) { + return checkNotificationHubAvailabilityWithResponse(resourceGroupName, namespaceName, parameters, Context.NONE) + .getValue(); + } + + /** + * Lists the PNS credentials associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPnsCredentialsWithResponseAsync(String resourceGroupName, + String namespaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getPnsCredentials(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the PNS credentials associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPnsCredentialsAsync(String resourceGroupName, String namespaceName) { + return getPnsCredentialsWithResponseAsync(resourceGroupName, namespaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists the PNS credentials associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPnsCredentialsWithResponse(String resourceGroupName, + String namespaceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getPnsCredentialsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context); + } + + /** + * Lists the PNS credentials associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PnsCredentialsResourceInner getPnsCredentials(String resourceGroupName, String namespaceName) { + return getPnsCredentialsWithResponse(resourceGroupName, namespaceName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(NamespaceResourcesClientImpl.class); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourcesImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourcesImpl.java new file mode 100644 index 000000000000..af1299dfff26 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespaceResourcesImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.notificationhubs.fluent.NamespaceResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityResult; +import com.azure.resourcemanager.notificationhubs.models.NamespaceResource; +import com.azure.resourcemanager.notificationhubs.models.NamespaceResources; +import com.azure.resourcemanager.notificationhubs.models.PnsCredentialsResource; + +public final class NamespaceResourcesImpl implements NamespaceResources { + private static final ClientLogger LOGGER = new ClientLogger(NamespaceResourcesImpl.class); + + private final NamespaceResourcesClient innerClient; + + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; + + public NamespaceResourcesImpl(NamespaceResourcesClient innerClient, + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String namespaceName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, namespaceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new NamespaceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NamespaceResource getByResourceGroup(String resourceGroupName, String namespaceName) { + NamespaceResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, namespaceName); + if (inner != null) { + return new NamespaceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String namespaceName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, namespaceName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String namespaceName) { + this.serviceClient().delete(resourceGroupName, namespaceName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NamespaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String skipToken, Integer top, + Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, skipToken, top, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NamespaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NamespaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String skipToken, Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(skipToken, top, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NamespaceResourceImpl(inner1, this.manager())); + } + + public Response checkNotificationHubAvailabilityWithResponse(String resourceGroupName, + String namespaceName, CheckAvailabilityParameters parameters, Context context) { + Response inner = this.serviceClient() + .checkNotificationHubAvailabilityWithResponse(resourceGroupName, namespaceName, parameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckAvailabilityResult checkNotificationHubAvailability(String resourceGroupName, String namespaceName, + CheckAvailabilityParameters parameters) { + CheckAvailabilityResultInner inner + = this.serviceClient().checkNotificationHubAvailability(resourceGroupName, namespaceName, parameters); + if (inner != null) { + return new CheckAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getPnsCredentialsWithResponse(String resourceGroupName, + String namespaceName, Context context) { + Response inner + = this.serviceClient().getPnsCredentialsWithResponse(resourceGroupName, namespaceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PnsCredentialsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PnsCredentialsResource getPnsCredentials(String resourceGroupName, String namespaceName) { + PnsCredentialsResourceInner inner = this.serviceClient().getPnsCredentials(resourceGroupName, namespaceName); + if (inner != null) { + return new PnsCredentialsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public NamespaceResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); + if (namespaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, namespaceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); + if (namespaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, namespaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); + if (namespaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, namespaceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); + if (namespaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, namespaceName, context); + } + + private NamespaceResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { + return this.serviceManager; + } + + public NamespaceResourceImpl define(String name) { + return new NamespaceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesClientImpl.java index ff69265f3fb0..388ac7b1dea6 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesClientImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; @@ -12,7 +12,6 @@ import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; import com.azure.core.annotation.Post; import com.azure.core.annotation.Put; @@ -28,25 +27,14 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.notificationhubs.fluent.NamespacesClient; -import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; import com.azure.resourcemanager.notificationhubs.fluent.models.ResourceListKeysInner; import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; -import com.azure.resourcemanager.notificationhubs.models.NamespaceCreateOrUpdateParameters; -import com.azure.resourcemanager.notificationhubs.models.NamespaceListResult; -import com.azure.resourcemanager.notificationhubs.models.NamespacePatchParameters; -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleListResult; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; +import com.azure.resourcemanager.notificationhubs.implementation.models.SharedAccessAuthorizationRuleListResult; +import com.azure.resourcemanager.notificationhubs.models.PolicyKeyResource; import reactor.core.publisher.Mono; /** @@ -61,189 +49,182 @@ public final class NamespacesClientImpl implements NamespacesClient { /** * The service client containing this operation class. */ - private final NotificationHubsManagementClientImpl client; + private final NotificationHubsClientImpl client; /** * Initializes an instance of NamespacesClientImpl. * * @param client the instance of the service client containing this operation class. */ - NamespacesClientImpl(NotificationHubsManagementClientImpl client) { + NamespacesClientImpl(NotificationHubsClientImpl client) { this.service = RestProxy.create(NamespacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for NotificationHubsManagementClientNamespaces to be used by the proxy - * service to perform REST calls. + * The interface defining all the services for NotificationHubsClientNamespaces to be used by the proxy service to + * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "NotificationHubsMana") + @Host("{endpoint}") + @ServiceInterface(name = "NotificationHubsClie") public interface NamespacesService { @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> checkAvailability(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") CheckAvailabilityParameters parameters, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, + Mono> getAuthorizationRule( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") NamespaceCreateOrUpdateParameters parameters, - @HeaderParam("Accept") String accept, Context context); + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> patch(@HostParam("$host") String endpoint, + Response getAuthorizationRuleSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") NamespacePatchParameters parameters, @HeaderParam("Accept") String accept, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") - @ExpectedResponses({ 200, 202, 204 }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("$host") String endpoint, + Mono> createOrUpdateAuthorizationRule( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - Context context); + @PathParam("authorizationRuleName") String authorizationRuleName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SharedAccessAuthorizationRuleResourceInner parameters, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}") - @ExpectedResponses({ 200 }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("$host") String endpoint, + Response createOrUpdateAuthorizationRuleSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); + @PathParam("authorizationRuleName") String authorizationRuleName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SharedAccessAuthorizationRuleResourceInner parameters, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") - @ExpectedResponses({ 200 }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}") + @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdateAuthorizationRule( - @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("namespaceName") String namespaceName, - @PathParam("authorizationRuleName") String authorizationRuleName, + Mono> deleteAuthorizationRule(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, - @HeaderParam("Accept") String accept, Context context); + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}") @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> deleteAuthorizationRule(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("authorizationRuleName") String authorizationRuleName, + Response deleteAuthorizationRuleSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getAuthorizationRule( - @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("namespaceName") String namespaceName, - @PathParam("authorizationRuleName") String authorizationRuleName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + Mono> listAuthorizationRules( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + Response listAuthorizationRulesSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces") + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/listKeys") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> listKeys(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules") + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/listKeys") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAuthorizationRules( - @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("namespaceName") String namespaceName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + Response listKeysSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys") + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listKeys(@HostParam("$host") String endpoint, + Mono> regenerateKeys(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, @PathParam("authorizationRuleName") String authorizationRuleName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PolicyKeyResource parameters, Context context); - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> regenerateKeys(@HostParam("$host") String endpoint, + Response regenerateKeysSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, @PathParam("authorizationRuleName") String authorizationRuleName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") PolicykeyResource parameters, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PolicyKeyResource parameters, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAllNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + Mono> listAuthorizationRulesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAuthorizationRulesNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Response listAuthorizationRulesNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * 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 an authorization rule for a namespace by name. * - * @param parameters The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response} on successful completion of + * @return an authorization rule for a namespace by name along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - checkAvailabilityWithResponseAsync(CheckAvailabilityParameters parameters) { + private Mono> getAuthorizationRuleWithResponseAsync( + String resourceGroupName, String namespaceName, String authorizationRuleName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -252,118 +233,128 @@ Mono> listAuthorizationRulesNe return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.checkAvailability(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), parameters, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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. - * - * @param parameters The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - checkAvailabilityWithResponseAsync(CheckAvailabilityParameters parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); + if (authorizationRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.checkAvailability(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), parameters, accept, context); + return FluxUtil + .withContext(context -> service.getAuthorizationRule(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, authorizationRuleName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * 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 an authorization rule for a namespace by name. * - * @param parameters The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource on successful completion of {@link Mono}. + * @return an authorization rule for a namespace by name on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono checkAvailabilityAsync(CheckAvailabilityParameters parameters) { - return checkAvailabilityWithResponseAsync(parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono getAuthorizationRuleAsync(String resourceGroupName, + String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * 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 an authorization rule for a namespace by name. * - * @param parameters The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response}. + * @return an authorization rule for a namespace by name along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response checkAvailabilityWithResponse(CheckAvailabilityParameters parameters, - Context context) { - return checkAvailabilityWithResponseAsync(parameters, context).block(); + public Response getAuthorizationRuleWithResponse( + String resourceGroupName, String namespaceName, String authorizationRuleName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getAuthorizationRuleSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, authorizationRuleName, accept, context); } /** - * 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 an authorization rule for a namespace by name. * - * @param parameters The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource. + * @return an authorization rule for a namespace by name. */ @ServiceMethod(returns = ReturnType.SINGLE) - public CheckAvailabilityResultInner checkAvailability(CheckAvailabilityParameters parameters) { - return checkAvailabilityWithResponse(parameters, Context.NONE).getValue(); + public SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, + String namespaceName, String authorizationRuleName) { + return getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, Context.NONE) + .getValue(); } /** - * Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This - * operation is idempotent. + * Creates an authorization rule for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to create a Namespace Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response} on successful completion of {@link Mono}. + * @return response for POST requests that return single SharedAccessAuthorizationRule along with {@link Response} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String namespaceName, NamespaceCreateOrUpdateParameters parameters) { + private Mono> createOrUpdateAuthorizationRuleWithResponseAsync( + String resourceGroupName, String namespaceName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -371,138 +362,138 @@ private Mono> createOrUpdateWithResponseAsync(S if (namespaceName == null) { return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (authorizationRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); } if (parameters == null) { return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, namespaceName, - this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context)) + .withContext(context -> service.createOrUpdateAuthorizationRule(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, namespaceName, + authorizationRuleName, contentType, accept, parameters, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This - * operation is idempotent. + * Creates an authorization rule for a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for POST requests that return single SharedAccessAuthorizationRule on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAuthorizationRuleAsync( + String resourceGroupName, String namespaceName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters) { + return createOrUpdateAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, + parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates an authorization rule for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to create a Namespace Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response} on successful completion of {@link Mono}. + * @return response for POST requests that return single SharedAccessAuthorizationRule along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String namespaceName, NamespaceCreateOrUpdateParameters parameters, Context context) { + public Response createOrUpdateAuthorizationRuleWithResponse( + String resourceGroupName, String namespaceName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } + final String contentType = "application/json"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, namespaceName, - this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context); - } - - /** - * Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This - * operation is idempotent. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to create a Namespace Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String namespaceName, - NamespaceCreateOrUpdateParameters parameters) { - return createOrUpdateWithResponseAsync(resourceGroupName, namespaceName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This - * operation is idempotent. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to create a Namespace Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String resourceGroupName, String namespaceName, - NamespaceCreateOrUpdateParameters parameters, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, namespaceName, parameters, context).block(); + return service.createOrUpdateAuthorizationRuleSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, authorizationRuleName, contentType, + accept, parameters, context); } /** - * Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This - * operation is idempotent. + * Creates an authorization rule for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to create a Namespace Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource. + * @return response for POST requests that return single SharedAccessAuthorizationRule. */ @ServiceMethod(returns = ReturnType.SINGLE) - public NamespaceResourceInner createOrUpdate(String resourceGroupName, String namespaceName, - NamespaceCreateOrUpdateParameters parameters) { - return createOrUpdateWithResponse(resourceGroupName, namespaceName, parameters, Context.NONE).getValue(); + public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, + String namespaceName, String authorizationRuleName, SharedAccessAuthorizationRuleResourceInner parameters) { + return createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, + parameters, Context.NONE).getValue(); } /** - * Patches the existing namespace. + * Deletes a namespace authorization rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to patch a Namespace Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchWithResponseAsync(String resourceGroupName, - String namespaceName, NamespacePatchParameters parameters) { + private Mono> deleteAuthorizationRuleWithResponseAsync(String resourceGroupName, + String namespaceName, String authorizationRuleName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -510,1147 +501,98 @@ private Mono> patchWithResponseAsync(String res if (namespaceName == null) { return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); + if (authorizationRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.patch(this.client.getEndpoint(), resourceGroupName, namespaceName, - this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context)) + .withContext(context -> service.deleteAuthorizationRule(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, namespaceName, + authorizationRuleName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Patches the existing namespace. + * Deletes a namespace authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, + String authorizationRuleName) { + return deleteAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a namespace authorization rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to patch a Namespace Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchWithResponseAsync(String resourceGroupName, - String namespaceName, NamespacePatchParameters parameters, Context context) { + public Response deleteAuthorizationRuleWithResponse(String resourceGroupName, String namespaceName, + String authorizationRuleName, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.patch(this.client.getEndpoint(), resourceGroupName, namespaceName, this.client.getApiVersion(), - this.client.getSubscriptionId(), parameters, accept, context); + return service.deleteAuthorizationRuleSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, authorizationRuleName, accept, context); } - /** - * Patches the existing namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to patch a Namespace Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono patchAsync(String resourceGroupName, String namespaceName, - NamespacePatchParameters parameters) { - return patchWithResponseAsync(resourceGroupName, namespaceName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Patches the existing namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to patch a Namespace Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchWithResponse(String resourceGroupName, String namespaceName, - NamespacePatchParameters parameters, Context context) { - return patchWithResponseAsync(resourceGroupName, namespaceName, parameters, context).block(); - } - - /** - * Patches the existing namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters Parameters supplied to patch a Namespace Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NamespaceResourceInner patch(String resourceGroupName, String namespaceName, - NamespacePatchParameters parameters) { - return patchWithResponse(resourceGroupName, namespaceName, parameters, Context.NONE).getValue(); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String namespaceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, namespaceName, - this.client.getApiVersion(), this.client.getSubscriptionId(), context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String namespaceName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), resourceGroupName, namespaceName, this.client.getApiVersion(), - this.client.getSubscriptionId(), context); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String namespaceName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, namespaceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String namespaceName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = deleteWithResponseAsync(resourceGroupName, namespaceName, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String namespaceName) { - return this.beginDeleteAsync(resourceGroupName, namespaceName).getSyncPoller(); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String namespaceName, - Context context) { - return this.beginDeleteAsync(resourceGroupName, namespaceName, context).getSyncPoller(); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String namespaceName) { - return beginDeleteAsync(resourceGroupName, namespaceName).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String namespaceName, Context context) { - return beginDeleteAsync(resourceGroupName, namespaceName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String namespaceName) { - deleteAsync(resourceGroupName, namespaceName).block(); - } - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String namespaceName, Context context) { - deleteAsync(resourceGroupName, namespaceName, context).block(); - } - - /** - * Returns the description for the specified namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String namespaceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, - namespaceName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Returns the description for the specified namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String namespaceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, namespaceName, - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); - } - - /** - * Returns the description for the specified namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, String namespaceName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, namespaceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Returns the description for the specified namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String namespaceName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, namespaceName, context).block(); - } - - /** - * Returns the description for the specified namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NamespaceResourceInner getByResourceGroup(String resourceGroupName, String namespaceName) { - return getByResourceGroupWithResponse(resourceGroupName, namespaceName, Context.NONE).getValue(); - } - - /** - * Creates an authorization rule for a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateAuthorizationRuleWithResponseAsync( - String resourceGroupName, String namespaceName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdateAuthorizationRule(this.client.getEndpoint(), - resourceGroupName, namespaceName, authorizationRuleName, this.client.getApiVersion(), - this.client.getSubscriptionId(), parameters, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Creates an authorization rule for a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateAuthorizationRuleWithResponseAsync( - String resourceGroupName, String namespaceName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdateAuthorizationRule(this.client.getEndpoint(), resourceGroupName, namespaceName, - authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, - context); - } - - /** - * Creates an authorization rule for a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAuthorizationRuleAsync( - String resourceGroupName, String namespaceName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { - return createOrUpdateAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, - parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Creates an authorization rule for a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateAuthorizationRuleWithResponse( - String resourceGroupName, String namespaceName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, Context context) { - return createOrUpdateAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, - parameters, context).block(); - } - - /** - * Creates an authorization rule for a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, - String namespaceName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { - return createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, - parameters, Context.NONE).getValue(); - } - - /** - * Deletes a namespace authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteAuthorizationRuleWithResponseAsync(String resourceGroupName, - String namespaceName, String authorizationRuleName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - return FluxUtil - .withContext( - context -> service.deleteAuthorizationRule(this.client.getEndpoint(), resourceGroupName, namespaceName, - authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Deletes a namespace authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteAuthorizationRuleWithResponseAsync(String resourceGroupName, - String namespaceName, String authorizationRuleName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - context = this.client.mergeContext(context); - return service.deleteAuthorizationRule(this.client.getEndpoint(), resourceGroupName, namespaceName, - authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), context); - } - - /** - * Deletes a namespace authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, - String authorizationRuleName) { - return deleteAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName) - .flatMap(ignored -> Mono.empty()); - } - - /** - * Deletes a namespace authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteAuthorizationRuleWithResponse(String resourceGroupName, String namespaceName, - String authorizationRuleName, Context context) { - return deleteAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, - context).block(); - } - - /** - * Deletes a namespace authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { - deleteAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, Context.NONE); - } - - /** - * Gets an authorization rule for a namespace by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getAuthorizationRuleWithResponseAsync( - String resourceGroupName, String namespaceName, String authorizationRuleName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAuthorizationRule(this.client.getEndpoint(), resourceGroupName, - namespaceName, authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), - accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets an authorization rule for a namespace by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization rule name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getAuthorizationRuleWithResponseAsync( - String resourceGroupName, String namespaceName, String authorizationRuleName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getAuthorizationRule(this.client.getEndpoint(), resourceGroupName, namespaceName, - authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); - } - - /** - * Gets an authorization rule for a namespace by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAuthorizationRuleAsync(String resourceGroupName, - String namespaceName, String authorizationRuleName) { - return getAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets an authorization rule for a namespace by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization rule name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAuthorizationRuleWithResponse( - String resourceGroupName, String namespaceName, String authorizationRuleName, Context context) { - return getAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, context) - .block(); - } - - /** - * Gets an authorization rule for a namespace by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, - String namespaceName, String authorizationRuleName) { - return getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, Context.NONE) - .getValue(); - } - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), resourceGroupName, - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), resourceGroupName, this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); - } - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); - } - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); - } - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listAllNextSinglePageAsync(nextLink, context)); - } - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); - } - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); - } - - /** - * Gets the authorization rules for a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a namespace along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listAuthorizationRulesSinglePageAsync(String resourceGroupName, String namespaceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listAuthorizationRules(this.client.getEndpoint(), resourceGroupName, - namespaceName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) - .>map( - res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + /** + * Deletes a namespace authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { + deleteAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, Context.NONE); } /** * Gets the authorization rules for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1659,11 +601,15 @@ public PagedIterable list(Context context) { */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> - listAuthorizationRulesSinglePageAsync(String resourceGroupName, String namespaceName, Context context) { + listAuthorizationRulesSinglePageAsync(String resourceGroupName, String namespaceName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -1671,24 +617,22 @@ public PagedIterable list(Context context) { if (namespaceName == null) { return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listAuthorizationRules(this.client.getEndpoint(), resourceGroupName, namespaceName, - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return FluxUtil + .withContext( + context -> service.listAuthorizationRules(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Gets the authorization rules for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1704,26 +648,87 @@ private PagedFlux listAuthorizationR /** * Gets the authorization rules for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a namespace along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse + listAuthorizationRulesSinglePage(String resourceGroupName, String namespaceName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAuthorizationRulesSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets the authorization rules for a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a namespace as paginated response with {@link PagedFlux}. + * @return the authorization rules for a namespace along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAuthorizationRulesAsync(String resourceGroupName, - String namespaceName, Context context) { - return new PagedFlux<>(() -> listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, context), - nextLink -> listAuthorizationRulesNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse + listAuthorizationRulesSinglePage(String resourceGroupName, String namespaceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAuthorizationRulesSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** * Gets the authorization rules for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1732,14 +737,15 @@ private PagedFlux listAuthorizationR @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listAuthorizationRules(String resourceGroupName, String namespaceName) { - return new PagedIterable<>(listAuthorizationRulesAsync(resourceGroupName, namespaceName)); + return new PagedIterable<>(() -> listAuthorizationRulesSinglePage(resourceGroupName, namespaceName), + nextLink -> listAuthorizationRulesNextSinglePage(nextLink)); } /** * Gets the authorization rules for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1749,15 +755,16 @@ public PagedIterable listAuthorizati @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listAuthorizationRules(String resourceGroupName, String namespaceName, Context context) { - return new PagedIterable<>(listAuthorizationRulesAsync(resourceGroupName, namespaceName, context)); + return new PagedIterable<>(() -> listAuthorizationRulesSinglePage(resourceGroupName, namespaceName, context), + nextLink -> listAuthorizationRulesNextSinglePage(nextLink, context)); } /** * Gets the Primary and Secondary ConnectionStrings to the namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1771,48 +778,10 @@ private Mono> listKeysWithResponseAsync(String r return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } if (this.client.getSubscriptionId() == null) { return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listKeys(this.client.getEndpoint(), resourceGroupName, namespaceName, - authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets the Primary and Secondary ConnectionStrings to the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the namespace along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listKeysWithResponseAsync(String resourceGroupName, - String namespaceName, String authorizationRuleName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -1824,22 +793,18 @@ private Mono> listKeysWithResponseAsync(String r return Mono .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listKeys(this.client.getEndpoint(), resourceGroupName, namespaceName, authorizationRuleName, - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return FluxUtil.withContext(context -> service.listKeys(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, authorizationRuleName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Gets the Primary and Secondary ConnectionStrings to the namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1855,9 +820,9 @@ private Mono listKeysAsync(String resourceGroupName, Stri /** * Gets the Primary and Secondary ConnectionStrings to the namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1867,15 +832,39 @@ private Mono listKeysAsync(String resourceGroupName, Stri @ServiceMethod(returns = ReturnType.SINGLE) public Response listKeysWithResponse(String resourceGroupName, String namespaceName, String authorizationRuleName, Context context) { - return listKeysWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.listKeysSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, authorizationRuleName, accept, context); } /** * Gets the Primary and Secondary ConnectionStrings to the namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1890,72 +879,27 @@ public ResourceListKeysInner listKeys(String resourceGroupName, String namespace /** * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response} on successful completion of - * {@link Mono}. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> regenerateKeysWithResponseAsync(String resourceGroupName, - String namespaceName, String authorizationRuleName, PolicykeyResource parameters) { + String namespaceName, String authorizationRuleName, PolicyKeyResource parameters) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } if (this.client.getSubscriptionId() == null) { return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.regenerateKeys(this.client.getEndpoint(), resourceGroupName, namespaceName, - authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> regenerateKeysWithResponseAsync(String resourceGroupName, - String namespaceName, String authorizationRuleName, PolicykeyResource parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -1967,37 +911,36 @@ private Mono> regenerateKeysWithResponseAsync(St return Mono .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } if (parameters == null) { return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } + final String contentType = "application/json"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.regenerateKeys(this.client.getEndpoint(), resourceGroupName, namespaceName, - authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, - context); + return FluxUtil + .withContext(context -> service.regenerateKeys(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, authorizationRuleName, contentType, + accept, parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String on successful completion of {@link Mono}. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono regenerateKeysAsync(String resourceGroupName, String namespaceName, - String authorizationRuleName, PolicykeyResource parameters) { + String authorizationRuleName, PolicyKeyResource parameters) { return regenerateKeysWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } @@ -2005,38 +948,70 @@ private Mono regenerateKeysAsync(String resourceGroupName /** * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response}. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, - String authorizationRuleName, PolicykeyResource parameters, Context context) { - return regenerateKeysWithResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters, - context).block(); + String authorizationRuleName, PolicyKeyResource parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.regenerateKeysSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, authorizationRuleName, contentType, + accept, parameters, context); } /** * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings). */ @ServiceMethod(returns = ReturnType.SINGLE) public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, - String authorizationRuleName, PolicykeyResource parameters) { + String authorizationRuleName, PolicyKeyResource parameters) { return regenerateKeysWithResponse(resourceGroupName, namespaceName, authorizationRuleName, parameters, Context.NONE).getValue(); } @@ -2048,64 +1023,12 @@ public ResourceListKeysInner regenerateKeys(String resourceGroupName, String nam * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return paged collection of SharedAccessAuthorizationRuleResource items along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllNextSinglePageAsync(String nextLink) { + private Mono> + listAuthorizationRulesNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2115,39 +1038,14 @@ private Mono> listAllNextSinglePageAsync(S } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext( + context -> service.listAuthorizationRulesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listAllNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * Get the next page of items. * @@ -2155,27 +1053,25 @@ private Mono> listAllNextSinglePageAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return paged collection of SharedAccessAuthorizationRuleResource items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listAuthorizationRulesNextSinglePageAsync(String nextLink) { + private PagedResponse + listAuthorizationRulesNextSinglePage(String nextLink) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listAuthorizationRulesNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + Response res + = service.listAuthorizationRulesNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2186,23 +1082,26 @@ private Mono> listAllNextSinglePageAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return paged collection of SharedAccessAuthorizationRuleResource items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listAuthorizationRulesNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse + listAuthorizationRulesNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listAuthorizationRulesNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listAuthorizationRulesNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(NamespacesClientImpl.class); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesImpl.java index b1e26553108d..f7a72009692d 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; @@ -10,15 +10,10 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.notificationhubs.fluent.NamespacesClient; -import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; import com.azure.resourcemanager.notificationhubs.fluent.models.ResourceListKeysInner; import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityResult; -import com.azure.resourcemanager.notificationhubs.models.NamespaceResource; import com.azure.resourcemanager.notificationhubs.models.Namespaces; -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; +import com.azure.resourcemanager.notificationhubs.models.PolicyKeyResource; import com.azure.resourcemanager.notificationhubs.models.ResourceListKeys; import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleResource; @@ -27,59 +22,57 @@ public final class NamespacesImpl implements Namespaces { private final NamespacesClient innerClient; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; public NamespacesImpl(NamespacesClient innerClient, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } - public Response checkAvailabilityWithResponse(CheckAvailabilityParameters parameters, - Context context) { - Response inner - = this.serviceClient().checkAvailabilityWithResponse(parameters, context); + public Response getAuthorizationRuleWithResponse(String resourceGroupName, + String namespaceName, String authorizationRuleName, Context context) { + Response inner = this.serviceClient() + .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new CheckAvailabilityResultImpl(inner.getValue(), this.manager())); + new SharedAccessAuthorizationRuleResourceImpl(inner.getValue(), this.manager())); } else { return null; } } - public CheckAvailabilityResult checkAvailability(CheckAvailabilityParameters parameters) { - CheckAvailabilityResultInner inner = this.serviceClient().checkAvailability(parameters); + public SharedAccessAuthorizationRuleResource getAuthorizationRule(String resourceGroupName, String namespaceName, + String authorizationRuleName) { + SharedAccessAuthorizationRuleResourceInner inner + = this.serviceClient().getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName); if (inner != null) { - return new CheckAvailabilityResultImpl(inner, this.manager()); + return new SharedAccessAuthorizationRuleResourceImpl(inner, this.manager()); } else { return null; } } - public void deleteByResourceGroup(String resourceGroupName, String namespaceName) { - this.serviceClient().delete(resourceGroupName, namespaceName); - } - - public void delete(String resourceGroupName, String namespaceName, Context context) { - this.serviceClient().delete(resourceGroupName, namespaceName, context); - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, String namespaceName, - Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, namespaceName, context); + public Response createOrUpdateAuthorizationRuleWithResponse( + String resourceGroupName, String namespaceName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters, Context context) { + Response inner = this.serviceClient() + .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, + parameters, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new NamespaceResourceImpl(inner.getValue(), this.manager())); + new SharedAccessAuthorizationRuleResourceImpl(inner.getValue(), this.manager())); } else { return null; } } - public NamespaceResource getByResourceGroup(String resourceGroupName, String namespaceName) { - NamespaceResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, namespaceName); + public SharedAccessAuthorizationRuleResource createOrUpdateAuthorizationRule(String resourceGroupName, + String namespaceName, String authorizationRuleName, SharedAccessAuthorizationRuleResourceInner parameters) { + SharedAccessAuthorizationRuleResourceInner inner = this.serviceClient() + .createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName, parameters); if (inner != null) { - return new NamespaceResourceImpl(inner, this.manager()); + return new SharedAccessAuthorizationRuleResourceImpl(inner, this.manager()); } else { return null; } @@ -95,50 +88,6 @@ public void deleteAuthorizationRule(String resourceGroupName, String namespaceNa this.serviceClient().deleteAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName); } - public Response getAuthorizationRuleWithResponse(String resourceGroupName, - String namespaceName, String authorizationRuleName, Context context) { - Response inner = this.serviceClient() - .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SharedAccessAuthorizationRuleResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SharedAccessAuthorizationRuleResource getAuthorizationRule(String resourceGroupName, String namespaceName, - String authorizationRuleName) { - SharedAccessAuthorizationRuleResourceInner inner - = this.serviceClient().getAuthorizationRule(resourceGroupName, namespaceName, authorizationRuleName); - if (inner != null) { - return new SharedAccessAuthorizationRuleResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new NamespaceResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new NamespaceResourceImpl(inner1, this.manager())); - } - - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new NamespaceResourceImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new NamespaceResourceImpl(inner1, this.manager())); - } - public PagedIterable listAuthorizationRules(String resourceGroupName, String namespaceName) { PagedIterable inner @@ -178,7 +127,7 @@ public ResourceListKeys listKeys(String resourceGroupName, String namespaceName, } public Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, - String authorizationRuleName, PolicykeyResource parameters, Context context) { + String authorizationRuleName, PolicyKeyResource parameters, Context context) { Response inner = this.serviceClient() .regenerateKeysWithResponse(resourceGroupName, namespaceName, authorizationRuleName, parameters, context); if (inner != null) { @@ -190,7 +139,7 @@ public Response regenerateKeysWithResponse(String resourceGrou } public ResourceListKeys regenerateKeys(String resourceGroupName, String namespaceName, String authorizationRuleName, - PolicykeyResource parameters) { + PolicyKeyResource parameters) { ResourceListKeysInner inner = this.serviceClient().regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters); if (inner != null) { @@ -200,155 +149,11 @@ public ResourceListKeys regenerateKeys(String resourceGroupName, String namespac } } - public NamespaceResource getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); - if (namespaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, namespaceName, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); - if (namespaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, namespaceName, context); - } - - public SharedAccessAuthorizationRuleResource getAuthorizationRuleById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); - if (namespaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); - } - String authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(id, "AuthorizationRules"); - if (authorizationRuleName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'AuthorizationRules'.", id))); - } - return this - .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, Context.NONE) - .getValue(); - } - - public Response getAuthorizationRuleByIdWithResponse(String id, - Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); - if (namespaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); - } - String authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(id, "AuthorizationRules"); - if (authorizationRuleName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'AuthorizationRules'.", id))); - } - return this.getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, context); - } - - public void deleteById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); - if (namespaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); - } - this.delete(resourceGroupName, namespaceName, Context.NONE); - } - - public void deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); - if (namespaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); - } - this.delete(resourceGroupName, namespaceName, context); - } - - public void deleteAuthorizationRuleById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); - if (namespaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); - } - String authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(id, "AuthorizationRules"); - if (authorizationRuleName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'AuthorizationRules'.", id))); - } - this.deleteAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, Context.NONE); - } - - public Response deleteAuthorizationRuleByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); - if (namespaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); - } - String authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(id, "AuthorizationRules"); - if (authorizationRuleName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'AuthorizationRules'.", id))); - } - return this.deleteAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, - context); - } - private NamespacesClient serviceClient() { return this.innerClient; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } - - public NamespaceResourceImpl define(String name) { - return new NamespaceResourceImpl(name, this.manager()); - } - - public SharedAccessAuthorizationRuleResourceImpl defineAuthorizationRule(String name) { - return new SharedAccessAuthorizationRuleResourceImpl(name, this.manager()); - } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesOperationGroupsClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesOperationGroupsClientImpl.java new file mode 100644 index 000000000000..abdb65d41560 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesOperationGroupsClientImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.notificationhubs.fluent.NamespacesOperationGroupsClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NamespacesOperationGroupsClient. + */ +public final class NamespacesOperationGroupsClientImpl implements NamespacesOperationGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final NamespacesOperationGroupsService service; + + /** + * The service client containing this operation class. + */ + private final NotificationHubsClientImpl client; + + /** + * Initializes an instance of NamespacesOperationGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NamespacesOperationGroupsClientImpl(NotificationHubsClientImpl client) { + this.service = RestProxy.create(NamespacesOperationGroupsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NotificationHubsClientNamespacesOperationGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NotificationHubsClie") + public interface NamespacesOperationGroupsService { + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkAvailability(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckAvailabilityParameters parameters, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response checkAvailabilitySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckAvailabilityParameters parameters, Context context); + } + + /** + * 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. + * + * @param parameters The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkAvailabilityWithResponseAsync(CheckAvailabilityParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * + * @param parameters The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkAvailabilityAsync(CheckAvailabilityParameters parameters) { + return checkAvailabilityWithResponseAsync(parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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. + * + * @param parameters The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkAvailabilityWithResponse(CheckAvailabilityParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.checkAvailabilitySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, parameters, context); + } + + /** + * 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. + * + * @param parameters The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckAvailabilityResultInner checkAvailability(CheckAvailabilityParameters parameters) { + return checkAvailabilityWithResponse(parameters, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(NamespacesOperationGroupsClientImpl.class); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesOperationGroupsImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesOperationGroupsImpl.java new file mode 100644 index 000000000000..212fe69b00c3 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NamespacesOperationGroupsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.notificationhubs.fluent.NamespacesOperationGroupsClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; +import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityResult; +import com.azure.resourcemanager.notificationhubs.models.NamespacesOperationGroups; + +public final class NamespacesOperationGroupsImpl implements NamespacesOperationGroups { + private static final ClientLogger LOGGER = new ClientLogger(NamespacesOperationGroupsImpl.class); + + private final NamespacesOperationGroupsClient innerClient; + + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; + + public NamespacesOperationGroupsImpl(NamespacesOperationGroupsClient innerClient, + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response checkAvailabilityWithResponse(CheckAvailabilityParameters parameters, + Context context) { + Response inner + = this.serviceClient().checkAvailabilityWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckAvailabilityResult checkAvailability(CheckAvailabilityParameters parameters) { + CheckAvailabilityResultInner inner = this.serviceClient().checkAvailability(parameters); + if (inner != null) { + return new CheckAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private NamespacesOperationGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourceImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourceImpl.java index 4d4d08efb990..a8b519d955ba 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourceImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourceImpl.java @@ -1,26 +1,29 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubResourceInner; import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; import com.azure.resourcemanager.notificationhubs.models.AdmCredential; import com.azure.resourcemanager.notificationhubs.models.ApnsCredential; import com.azure.resourcemanager.notificationhubs.models.BaiduCredential; +import com.azure.resourcemanager.notificationhubs.models.BrowserCredential; import com.azure.resourcemanager.notificationhubs.models.DebugSendResponse; +import com.azure.resourcemanager.notificationhubs.models.FcmV1Credential; import com.azure.resourcemanager.notificationhubs.models.GcmCredential; import com.azure.resourcemanager.notificationhubs.models.MpnsCredential; -import com.azure.resourcemanager.notificationhubs.models.NotificationHubCreateOrUpdateParameters; import com.azure.resourcemanager.notificationhubs.models.NotificationHubPatchParameters; import com.azure.resourcemanager.notificationhubs.models.NotificationHubResource; import com.azure.resourcemanager.notificationhubs.models.PnsCredentialsResource; import com.azure.resourcemanager.notificationhubs.models.Sku; import com.azure.resourcemanager.notificationhubs.models.WnsCredential; +import com.azure.resourcemanager.notificationhubs.models.XiaomiCredential; import java.util.Collections; import java.util.List; import java.util.Map; @@ -29,7 +32,7 @@ public final class NotificationHubResourceImpl implements NotificationHubResource, NotificationHubResource.Definition, NotificationHubResource.Update { private NotificationHubResourceInner innerObject; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; public String id() { return this.innerModel().id(); @@ -60,6 +63,10 @@ public Sku sku() { return this.innerModel().sku(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String namePropertiesName() { return this.innerModel().namePropertiesName(); } @@ -101,6 +108,22 @@ public BaiduCredential baiduCredential() { return this.innerModel().baiduCredential(); } + public BrowserCredential browserCredential() { + return this.innerModel().browserCredential(); + } + + public XiaomiCredential xiaomiCredential() { + return this.innerModel().xiaomiCredential(); + } + + public FcmV1Credential fcmV1Credential() { + return this.innerModel().fcmV1Credential(); + } + + public Long dailyMaxActiveDevices() { + return this.innerModel().dailyMaxActiveDevices(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -117,7 +140,7 @@ public NotificationHubResourceInner innerModel() { return this.innerObject; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } @@ -127,8 +150,6 @@ private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manag private String notificationHubName; - private NotificationHubCreateOrUpdateParameters createParameters; - private NotificationHubPatchParameters updateParameters; public NotificationHubResourceImpl withExistingNamespace(String resourceGroupName, String namespaceName) { @@ -139,8 +160,8 @@ public NotificationHubResourceImpl withExistingNamespace(String resourceGroupNam public NotificationHubResource create() { this.innerObject = serviceManager.serviceClient() - .getNotificationHubs() - .createOrUpdateWithResponse(resourceGroupName, namespaceName, notificationHubName, createParameters, + .getNotificationHubResources() + .createOrUpdateWithResponse(resourceGroupName, namespaceName, notificationHubName, this.innerModel(), Context.NONE) .getValue(); return this; @@ -148,19 +169,18 @@ public NotificationHubResource create() { public NotificationHubResource create(Context context) { this.innerObject = serviceManager.serviceClient() - .getNotificationHubs() - .createOrUpdateWithResponse(resourceGroupName, namespaceName, notificationHubName, createParameters, + .getNotificationHubResources() + .createOrUpdateWithResponse(resourceGroupName, namespaceName, notificationHubName, this.innerModel(), context) .getValue(); return this; } NotificationHubResourceImpl(String name, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = new NotificationHubResourceInner(); this.serviceManager = serviceManager; this.notificationHubName = name; - this.createParameters = new NotificationHubCreateOrUpdateParameters(); } public NotificationHubResourceImpl update() { @@ -170,22 +190,22 @@ public NotificationHubResourceImpl update() { public NotificationHubResource apply() { this.innerObject = serviceManager.serviceClient() - .getNotificationHubs() - .patchWithResponse(resourceGroupName, namespaceName, notificationHubName, updateParameters, Context.NONE) + .getNotificationHubResources() + .updateWithResponse(resourceGroupName, namespaceName, notificationHubName, updateParameters, Context.NONE) .getValue(); return this; } public NotificationHubResource apply(Context context) { this.innerObject = serviceManager.serviceClient() - .getNotificationHubs() - .patchWithResponse(resourceGroupName, namespaceName, notificationHubName, updateParameters, context) + .getNotificationHubResources() + .updateWithResponse(resourceGroupName, namespaceName, notificationHubName, updateParameters, context) .getValue(); return this; } NotificationHubResourceImpl(NotificationHubResourceInner innerObject, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); @@ -195,7 +215,7 @@ public NotificationHubResource apply(Context context) { public NotificationHubResource refresh() { this.innerObject = serviceManager.serviceClient() - .getNotificationHubs() + .getNotificationHubResources() .getWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE) .getValue(); return this; @@ -203,44 +223,45 @@ public NotificationHubResource refresh() { public NotificationHubResource refresh(Context context) { this.innerObject = serviceManager.serviceClient() - .getNotificationHubs() + .getNotificationHubResources() .getWithResponse(resourceGroupName, namespaceName, notificationHubName, context) .getValue(); return this; } - public Response debugSendWithResponse(Object parameters, Context context) { - return serviceManager.notificationHubs() - .debugSendWithResponse(resourceGroupName, namespaceName, notificationHubName, parameters, context); + public Response debugSendWithResponse(Context context) { + return serviceManager.notificationHubResources() + .debugSendWithResponse(resourceGroupName, namespaceName, notificationHubName, context); } public DebugSendResponse debugSend() { - return serviceManager.notificationHubs().debugSend(resourceGroupName, namespaceName, notificationHubName); + return serviceManager.notificationHubResources() + .debugSend(resourceGroupName, namespaceName, notificationHubName); } public Response getPnsCredentialsWithResponse(Context context) { - return serviceManager.notificationHubs() + return serviceManager.notificationHubResources() .getPnsCredentialsWithResponse(resourceGroupName, namespaceName, notificationHubName, context); } public PnsCredentialsResource getPnsCredentials() { - return serviceManager.notificationHubs() + return serviceManager.notificationHubResources() .getPnsCredentials(resourceGroupName, namespaceName, notificationHubName); } public NotificationHubResourceImpl withRegion(Region location) { - this.createParameters.withLocation(location.toString()); + this.innerModel().withLocation(location.toString()); return this; } public NotificationHubResourceImpl withRegion(String location) { - this.createParameters.withLocation(location); + this.innerModel().withLocation(location); return this; } public NotificationHubResourceImpl withTags(Map tags) { if (isInCreateMode()) { - this.createParameters.withTags(tags); + this.innerModel().withTags(tags); return this; } else { this.updateParameters.withTags(tags); @@ -250,7 +271,7 @@ public NotificationHubResourceImpl withTags(Map tags) { public NotificationHubResourceImpl withSku(Sku sku) { if (isInCreateMode()) { - this.createParameters.withSku(sku); + this.innerModel().withSku(sku); return this; } else { this.updateParameters.withSku(sku); @@ -259,18 +280,13 @@ public NotificationHubResourceImpl withSku(Sku sku) { } public NotificationHubResourceImpl withNamePropertiesName(String namePropertiesName) { - if (isInCreateMode()) { - this.createParameters.withNamePropertiesName(namePropertiesName); - return this; - } else { - this.updateParameters.withNamePropertiesName(namePropertiesName); - return this; - } + this.innerModel().withNamePropertiesName(namePropertiesName); + return this; } public NotificationHubResourceImpl withRegistrationTtl(String registrationTtl) { if (isInCreateMode()) { - this.createParameters.withRegistrationTtl(registrationTtl); + this.innerModel().withRegistrationTtl(registrationTtl); return this; } else { this.updateParameters.withRegistrationTtl(registrationTtl); @@ -278,20 +294,9 @@ public NotificationHubResourceImpl withRegistrationTtl(String registrationTtl) { } } - public NotificationHubResourceImpl - withAuthorizationRules(List authorizationRules) { - if (isInCreateMode()) { - this.createParameters.withAuthorizationRules(authorizationRules); - return this; - } else { - this.updateParameters.withAuthorizationRules(authorizationRules); - return this; - } - } - public NotificationHubResourceImpl withApnsCredential(ApnsCredential apnsCredential) { if (isInCreateMode()) { - this.createParameters.withApnsCredential(apnsCredential); + this.innerModel().withApnsCredential(apnsCredential); return this; } else { this.updateParameters.withApnsCredential(apnsCredential); @@ -301,7 +306,7 @@ public NotificationHubResourceImpl withApnsCredential(ApnsCredential apnsCredent public NotificationHubResourceImpl withWnsCredential(WnsCredential wnsCredential) { if (isInCreateMode()) { - this.createParameters.withWnsCredential(wnsCredential); + this.innerModel().withWnsCredential(wnsCredential); return this; } else { this.updateParameters.withWnsCredential(wnsCredential); @@ -311,7 +316,7 @@ public NotificationHubResourceImpl withWnsCredential(WnsCredential wnsCredential public NotificationHubResourceImpl withGcmCredential(GcmCredential gcmCredential) { if (isInCreateMode()) { - this.createParameters.withGcmCredential(gcmCredential); + this.innerModel().withGcmCredential(gcmCredential); return this; } else { this.updateParameters.withGcmCredential(gcmCredential); @@ -321,7 +326,7 @@ public NotificationHubResourceImpl withGcmCredential(GcmCredential gcmCredential public NotificationHubResourceImpl withMpnsCredential(MpnsCredential mpnsCredential) { if (isInCreateMode()) { - this.createParameters.withMpnsCredential(mpnsCredential); + this.innerModel().withMpnsCredential(mpnsCredential); return this; } else { this.updateParameters.withMpnsCredential(mpnsCredential); @@ -331,7 +336,7 @@ public NotificationHubResourceImpl withMpnsCredential(MpnsCredential mpnsCredent public NotificationHubResourceImpl withAdmCredential(AdmCredential admCredential) { if (isInCreateMode()) { - this.createParameters.withAdmCredential(admCredential); + this.innerModel().withAdmCredential(admCredential); return this; } else { this.updateParameters.withAdmCredential(admCredential); @@ -341,7 +346,7 @@ public NotificationHubResourceImpl withAdmCredential(AdmCredential admCredential public NotificationHubResourceImpl withBaiduCredential(BaiduCredential baiduCredential) { if (isInCreateMode()) { - this.createParameters.withBaiduCredential(baiduCredential); + this.innerModel().withBaiduCredential(baiduCredential); return this; } else { this.updateParameters.withBaiduCredential(baiduCredential); @@ -349,6 +354,36 @@ public NotificationHubResourceImpl withBaiduCredential(BaiduCredential baiduCred } } + public NotificationHubResourceImpl withBrowserCredential(BrowserCredential browserCredential) { + if (isInCreateMode()) { + this.innerModel().withBrowserCredential(browserCredential); + return this; + } else { + this.updateParameters.withBrowserCredential(browserCredential); + return this; + } + } + + public NotificationHubResourceImpl withXiaomiCredential(XiaomiCredential xiaomiCredential) { + if (isInCreateMode()) { + this.innerModel().withXiaomiCredential(xiaomiCredential); + return this; + } else { + this.updateParameters.withXiaomiCredential(xiaomiCredential); + return this; + } + } + + public NotificationHubResourceImpl withFcmV1Credential(FcmV1Credential fcmV1Credential) { + if (isInCreateMode()) { + this.innerModel().withFcmV1Credential(fcmV1Credential); + return this; + } else { + this.updateParameters.withFcmV1Credential(fcmV1Credential); + return this; + } + } + private boolean isInCreateMode() { return this.innerModel().id() == null; } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourcesClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourcesClientImpl.java new file mode 100644 index 000000000000..5e6982d36bcf --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourcesClientImpl.java @@ -0,0 +1,1250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.notificationhubs.fluent.NotificationHubResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubResourceInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; +import com.azure.resourcemanager.notificationhubs.implementation.models.NotificationHubListResult; +import com.azure.resourcemanager.notificationhubs.models.NotificationHubPatchParameters; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NotificationHubResourcesClient. + */ +public final class NotificationHubResourcesClientImpl implements NotificationHubResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final NotificationHubResourcesService service; + + /** + * The service client containing this operation class. + */ + private final NotificationHubsClientImpl client; + + /** + * Initializes an instance of NotificationHubResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NotificationHubResourcesClientImpl(NotificationHubsClientImpl client) { + this.service = RestProxy.create(NotificationHubResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NotificationHubsClientNotificationHubResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NotificationHubsClie") + public interface NotificationHubResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NotificationHubResourceInner parameters, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NotificationHubResourceInner parameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NotificationHubPatchParameters parameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NotificationHubPatchParameters parameters, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @QueryParam("$skipToken") String skipToken, @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @QueryParam("$skipToken") String skipToken, @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/debugsend") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> debugSend(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/debugsend") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response debugSendSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getPnsCredentials(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getPnsCredentialsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String namespaceName, String notificationHubName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String namespaceName, + String notificationHubName) { + return getWithResponseAsync(resourceGroupName, namespaceName, notificationHubName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, namespaceName, notificationHubName, accept, context); + } + + /** + * Gets the notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotificationHubResourceInner get(String resourceGroupName, String namespaceName, + String notificationHubName) { + return getWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE).getValue(); + } + + /** + * Creates/Update a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String namespaceName, String notificationHubName, NotificationHubResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, contentType, + accept, parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates/Update a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String namespaceName, + String notificationHubName, NotificationHubResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates/Update a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String namespaceName, String notificationHubName, NotificationHubResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, contentType, accept, + parameters, context); + } + + /** + * Creates/Update a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotificationHubResourceInner createOrUpdate(String resourceGroupName, String namespaceName, + String notificationHubName, NotificationHubResourceInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, namespaceName, notificationHubName, parameters, + Context.NONE).getValue(); + } + + /** + * Patch a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String namespaceName, String notificationHubName, NotificationHubPatchParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, contentType, + accept, parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Patch a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String namespaceName, + String notificationHubName, NotificationHubPatchParameters parameters) { + return updateWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Patch a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, NotificationHubPatchParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, contentType, accept, + parameters, context); + } + + /** + * Patch a NotificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hub Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotificationHubResourceInner update(String resourceGroupName, String namespaceName, + String notificationHubName, NotificationHubPatchParameters parameters) { + return updateWithResponse(resourceGroupName, namespaceName, notificationHubName, parameters, Context.NONE) + .getValue(); + } + + /** + * Deletes a notification hub associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String namespaceName, + String notificationHubName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a notification hub associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String namespaceName, String notificationHubName) { + return deleteWithResponseAsync(resourceGroupName, namespaceName, notificationHubName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a notification hub associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String namespaceName, String notificationHubName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, accept, context); + } + + /** + * Deletes a notification hub associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String namespaceName, String notificationHubName) { + deleteWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE); + } + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param skipToken Continuation token. + * @param top Page size. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String namespaceName, String skipToken, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, skipToken, top, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param skipToken Continuation token. + * @param top Page size. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String namespaceName, + String skipToken, Integer top) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, namespaceName, skipToken, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String namespaceName) { + final String skipToken = null; + final Integer top = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, namespaceName, skipToken, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param skipToken Continuation token. + * @param top Page size. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String namespaceName, + String skipToken, Integer top) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, namespaceName, skipToken, top, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param skipToken Continuation token. + * @param top Page size. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String namespaceName, + String skipToken, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, namespaceName, skipToken, top, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String namespaceName) { + final String skipToken = null; + final Integer top = null; + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, namespaceName, skipToken, top), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param skipToken Continuation token. + * @param top Page size. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String namespaceName, + String skipToken, Integer top, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, namespaceName, skipToken, top, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Test send a push notification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> debugSendWithResponseAsync(String resourceGroupName, + String namespaceName, String notificationHubName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.debugSend(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Test send a push notification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono debugSendAsync(String resourceGroupName, String namespaceName, + String notificationHubName) { + return debugSendWithResponseAsync(resourceGroupName, namespaceName, notificationHubName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Test send a push notification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response debugSendWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.debugSendSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, accept, context); + } + + /** + * Test send a push notification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DebugSendResponseInner debugSend(String resourceGroupName, String namespaceName, + String notificationHubName) { + return debugSendWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE).getValue(); + } + + /** + * Lists the PNS Credentials associated with a notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPnsCredentialsWithResponseAsync(String resourceGroupName, + String namespaceName, String notificationHubName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getPnsCredentials(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the PNS Credentials associated with a notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPnsCredentialsAsync(String resourceGroupName, String namespaceName, + String notificationHubName) { + return getPnsCredentialsWithResponseAsync(resourceGroupName, namespaceName, notificationHubName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists the PNS Credentials associated with a notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPnsCredentialsWithResponse(String resourceGroupName, + String namespaceName, String notificationHubName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getPnsCredentialsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, accept, context); + } + + /** + * Lists the PNS Credentials associated with a notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PnsCredentialsResourceInner getPnsCredentials(String resourceGroupName, String namespaceName, + String notificationHubName) { + return getPnsCredentialsWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(NotificationHubResourcesClientImpl.class); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourcesImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourcesImpl.java new file mode 100644 index 000000000000..6c91f92e9135 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubResourcesImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.notificationhubs.fluent.NotificationHubResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubResourceInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; +import com.azure.resourcemanager.notificationhubs.models.DebugSendResponse; +import com.azure.resourcemanager.notificationhubs.models.NotificationHubResource; +import com.azure.resourcemanager.notificationhubs.models.NotificationHubResources; +import com.azure.resourcemanager.notificationhubs.models.PnsCredentialsResource; + +public final class NotificationHubResourcesImpl implements NotificationHubResources { + private static final ClientLogger LOGGER = new ClientLogger(NotificationHubResourcesImpl.class); + + private final NotificationHubResourcesClient innerClient; + + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; + + public NotificationHubResourcesImpl(NotificationHubResourcesClient innerClient, + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, namespaceName, notificationHubName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new NotificationHubResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NotificationHubResource get(String resourceGroupName, String namespaceName, String notificationHubName) { + NotificationHubResourceInner inner + = this.serviceClient().get(resourceGroupName, namespaceName, notificationHubName); + if (inner != null) { + return new NotificationHubResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String namespaceName, String notificationHubName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, namespaceName, notificationHubName, context); + } + + public void delete(String resourceGroupName, String namespaceName, String notificationHubName) { + this.serviceClient().delete(resourceGroupName, namespaceName, notificationHubName); + } + + public PagedIterable list(String resourceGroupName, String namespaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, namespaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NotificationHubResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String namespaceName, String skipToken, + Integer top, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, namespaceName, skipToken, top, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NotificationHubResourceImpl(inner1, this.manager())); + } + + public Response debugSendWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context) { + Response inner = this.serviceClient() + .debugSendWithResponse(resourceGroupName, namespaceName, notificationHubName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DebugSendResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DebugSendResponse debugSend(String resourceGroupName, String namespaceName, String notificationHubName) { + DebugSendResponseInner inner + = this.serviceClient().debugSend(resourceGroupName, namespaceName, notificationHubName); + if (inner != null) { + return new DebugSendResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getPnsCredentialsWithResponse(String resourceGroupName, + String namespaceName, String notificationHubName, Context context) { + Response inner = this.serviceClient() + .getPnsCredentialsWithResponse(resourceGroupName, namespaceName, notificationHubName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PnsCredentialsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PnsCredentialsResource getPnsCredentials(String resourceGroupName, String namespaceName, + String notificationHubName) { + PnsCredentialsResourceInner inner + = this.serviceClient().getPnsCredentials(resourceGroupName, namespaceName, notificationHubName); + if (inner != null) { + return new PnsCredentialsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public NotificationHubResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); + if (namespaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); + } + String notificationHubName = ResourceManagerUtils.getValueFromIdByName(id, "notificationHubs"); + if (notificationHubName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'notificationHubs'.", id))); + } + return this.getWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); + if (namespaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); + } + String notificationHubName = ResourceManagerUtils.getValueFromIdByName(id, "notificationHubs"); + if (notificationHubName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'notificationHubs'.", id))); + } + return this.getWithResponse(resourceGroupName, namespaceName, notificationHubName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); + if (namespaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); + } + String notificationHubName = ResourceManagerUtils.getValueFromIdByName(id, "notificationHubs"); + if (notificationHubName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'notificationHubs'.", id))); + } + this.deleteWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String namespaceName = ResourceManagerUtils.getValueFromIdByName(id, "namespaces"); + if (namespaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'namespaces'.", id))); + } + String notificationHubName = ResourceManagerUtils.getValueFromIdByName(id, "notificationHubs"); + if (notificationHubName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'notificationHubs'.", id))); + } + return this.deleteWithResponse(resourceGroupName, namespaceName, notificationHubName, context); + } + + private NotificationHubResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { + return this.serviceManager; + } + + public NotificationHubResourceImpl define(String name) { + return new NotificationHubResourceImpl(name, this.manager()); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsManagementClientBuilder.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsClientBuilder.java similarity index 60% rename from sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsManagementClientBuilder.java rename to sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsClientBuilder.java index 1f76e6808497..93bd96f9d0a5 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsManagementClientBuilder.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsClientBuilder.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; @@ -15,41 +15,39 @@ import java.time.Duration; /** - * A builder for creating a new instance of the NotificationHubsManagementClientImpl type. + * A builder for creating a new instance of the NotificationHubsClientImpl type. */ -@ServiceClientBuilder(serviceClients = { NotificationHubsManagementClientImpl.class }) -public final class NotificationHubsManagementClientBuilder { +@ServiceClientBuilder(serviceClients = { NotificationHubsClientImpl.class }) +public final class NotificationHubsClientBuilder { /* - * Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms - * part of the URI for every service call. + * Service host */ - private String subscriptionId; + private String endpoint; /** - * Sets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID - * forms part of the URI for every service call. + * Sets Service host. * - * @param subscriptionId the subscriptionId value. - * @return the NotificationHubsManagementClientBuilder. + * @param endpoint the endpoint value. + * @return the NotificationHubsClientBuilder. */ - public NotificationHubsManagementClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; + public NotificationHubsClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } /* - * server parameter + * The ID of the target subscription. The value must be an UUID. */ - private String endpoint; + private String subscriptionId; /** - * Sets server parameter. + * Sets The ID of the target subscription. The value must be an UUID. * - * @param endpoint the endpoint value. - * @return the NotificationHubsManagementClientBuilder. + * @param subscriptionId the subscriptionId value. + * @return the NotificationHubsClientBuilder. */ - public NotificationHubsManagementClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; + public NotificationHubsClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; return this; } @@ -62,9 +60,9 @@ public NotificationHubsManagementClientBuilder endpoint(String endpoint) { * Sets The environment to connect to. * * @param environment the environment value. - * @return the NotificationHubsManagementClientBuilder. + * @return the NotificationHubsClientBuilder. */ - public NotificationHubsManagementClientBuilder environment(AzureEnvironment environment) { + public NotificationHubsClientBuilder environment(AzureEnvironment environment) { this.environment = environment; return this; } @@ -78,9 +76,9 @@ public NotificationHubsManagementClientBuilder environment(AzureEnvironment envi * Sets The HTTP pipeline to send requests through. * * @param pipeline the pipeline value. - * @return the NotificationHubsManagementClientBuilder. + * @return the NotificationHubsClientBuilder. */ - public NotificationHubsManagementClientBuilder pipeline(HttpPipeline pipeline) { + public NotificationHubsClientBuilder pipeline(HttpPipeline pipeline) { this.pipeline = pipeline; return this; } @@ -94,9 +92,9 @@ public NotificationHubsManagementClientBuilder pipeline(HttpPipeline pipeline) { * Sets The default poll interval for long-running operation. * * @param defaultPollInterval the defaultPollInterval value. - * @return the NotificationHubsManagementClientBuilder. + * @return the NotificationHubsClientBuilder. */ - public NotificationHubsManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + public NotificationHubsClientBuilder defaultPollInterval(Duration defaultPollInterval) { this.defaultPollInterval = defaultPollInterval; return this; } @@ -110,19 +108,19 @@ public NotificationHubsManagementClientBuilder defaultPollInterval(Duration defa * Sets The serializer to serialize an object into a string. * * @param serializerAdapter the serializerAdapter value. - * @return the NotificationHubsManagementClientBuilder. + * @return the NotificationHubsClientBuilder. */ - public NotificationHubsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + public NotificationHubsClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { this.serializerAdapter = serializerAdapter; return this; } /** - * Builds an instance of NotificationHubsManagementClientImpl with the provided parameters. + * Builds an instance of NotificationHubsClientImpl with the provided parameters. * - * @return an instance of NotificationHubsManagementClientImpl. + * @return an instance of NotificationHubsClientImpl. */ - public NotificationHubsManagementClientImpl buildClient() { + public NotificationHubsClientImpl buildClient() { String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; HttpPipeline localPipeline = (pipeline != null) @@ -133,8 +131,8 @@ public NotificationHubsManagementClientImpl buildClient() { SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter : SerializerFactory.createDefaultManagementSerializerAdapter(); - NotificationHubsManagementClientImpl client = new NotificationHubsManagementClientImpl(localPipeline, - localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + NotificationHubsClientImpl client = new NotificationHubsClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); return client; } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsClientImpl.java index 69d9e703a3f5..6b49fdcb523d 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsClientImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsClientImpl.java @@ -1,2445 +1,420 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.notificationhubs.fluent.NamespaceResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.NamespacesClient; +import com.azure.resourcemanager.notificationhubs.fluent.NamespacesOperationGroupsClient; +import com.azure.resourcemanager.notificationhubs.fluent.NotificationHubResourcesClient; import com.azure.resourcemanager.notificationhubs.fluent.NotificationHubsClient; -import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubResourceInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.ResourceListKeysInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; -import com.azure.resourcemanager.notificationhubs.models.NotificationHubCreateOrUpdateParameters; -import com.azure.resourcemanager.notificationhubs.models.NotificationHubListResult; -import com.azure.resourcemanager.notificationhubs.models.NotificationHubPatchParameters; -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleListResult; +import com.azure.resourcemanager.notificationhubs.fluent.OperationsClient; +import com.azure.resourcemanager.notificationhubs.fluent.PrivateEndpointConnectionResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.SharedAccessAuthorizationRuleResourcesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** - * An instance of this class provides access to all the operations defined in NotificationHubsClient. + * Initializes a new instance of the NotificationHubsClientImpl type. */ +@ServiceClient(builder = NotificationHubsClientBuilder.class) public final class NotificationHubsClientImpl implements NotificationHubsClient { /** - * The proxy service used to perform REST calls. + * Service host. */ - private final NotificationHubsService service; + private final String endpoint; /** - * The service client containing this operation class. - */ - private final NotificationHubsManagementClientImpl client; - - /** - * Initializes an instance of NotificationHubsClientImpl. + * Gets Service host. * - * @param client the instance of the service client containing this operation class. + * @return the endpoint value. */ - NotificationHubsClientImpl(NotificationHubsManagementClientImpl client) { - this.service - = RestProxy.create(NotificationHubsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; + public String getEndpoint() { + return this.endpoint; } /** - * The interface defining all the services for NotificationHubsManagementClientNotificationHubs to be used by the - * proxy service to perform REST calls. + * Version parameter. */ - @Host("{$host}") - @ServiceInterface(name = "NotificationHubsMana") - public interface NotificationHubsService { - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> checkNotificationHubAvailability( - @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("namespaceName") String namespaceName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") CheckAvailabilityParameters parameters, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") NotificationHubCreateOrUpdateParameters parameters, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> patch(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") NotificationHubPatchParameters parameters, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/debugsend") - @ExpectedResponses({ 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> debugSend(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, @BodyParam("application/json") Object parameters, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdateAuthorizationRule( - @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, - @PathParam("authorizationRuleName") String authorizationRuleName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> deleteAuthorizationRule(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, - @PathParam("authorizationRuleName") String authorizationRuleName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getAuthorizationRule( - @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, - @PathParam("authorizationRuleName") String authorizationRuleName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAuthorizationRules( - @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listKeys(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, - @PathParam("authorizationRuleName") String authorizationRuleName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> regenerateKeys(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, - @PathParam("authorizationRuleName") String authorizationRuleName, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") PolicykeyResource parameters, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getPnsCredentials(@HostParam("$host") String endpoint, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, - @PathParam("notificationHubName") String notificationHubName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAuthorizationRulesNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } + private final String apiVersion; /** - * Checks the availability of the given notificationHub in a namespace. + * Gets Version parameter. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters The notificationHub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the apiVersion value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> checkNotificationHubAvailabilityWithResponseAsync( - String resourceGroupName, String namespaceName, CheckAvailabilityParameters parameters) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.checkNotificationHubAvailability(this.client.getEndpoint(), - resourceGroupName, namespaceName, this.client.getApiVersion(), this.client.getSubscriptionId(), - parameters, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + public String getApiVersion() { + return this.apiVersion; } /** - * Checks the availability of the given notificationHub in a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters The notificationHub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response} on successful completion of - * {@link Mono}. + * The ID of the target subscription. The value must be an UUID. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> checkNotificationHubAvailabilityWithResponseAsync( - String resourceGroupName, String namespaceName, CheckAvailabilityParameters parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.checkNotificationHubAvailability(this.client.getEndpoint(), resourceGroupName, namespaceName, - this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context); - } + private final String subscriptionId; /** - * Checks the availability of the given notificationHub in a namespace. + * Gets The ID of the target subscription. The value must be an UUID. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters The notificationHub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource on successful completion of {@link Mono}. + * @return the subscriptionId value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono checkNotificationHubAvailabilityAsync(String resourceGroupName, - String namespaceName, CheckAvailabilityParameters parameters) { - return checkNotificationHubAvailabilityWithResponseAsync(resourceGroupName, namespaceName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public String getSubscriptionId() { + return this.subscriptionId; } /** - * Checks the availability of the given notificationHub in a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters The notificationHub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response}. + * The HTTP pipeline to send requests through. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response checkNotificationHubAvailabilityWithResponse(String resourceGroupName, - String namespaceName, CheckAvailabilityParameters parameters, Context context) { - return checkNotificationHubAvailabilityWithResponseAsync(resourceGroupName, namespaceName, parameters, context) - .block(); - } + private final HttpPipeline httpPipeline; /** - * Checks the availability of the given notificationHub in a namespace. + * Gets The HTTP pipeline to send requests through. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters The notificationHub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource. + * @return the httpPipeline value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CheckAvailabilityResultInner checkNotificationHubAvailability(String resourceGroupName, String namespaceName, - CheckAvailabilityParameters parameters) { - return checkNotificationHubAvailabilityWithResponse(resourceGroupName, namespaceName, parameters, Context.NONE) - .getValue(); + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; } /** - * Creates/Update a NotificationHub in a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to the create/update a NotificationHub Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response} on successful completion of - * {@link Mono}. + * The serializer to serialize an object into a string. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, NotificationHubCreateOrUpdateParameters parameters) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } + private final SerializerAdapter serializerAdapter; /** - * Creates/Update a NotificationHub in a namespace. + * Gets The serializer to serialize an object into a string. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to the create/update a NotificationHub Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the serializerAdapter value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, NotificationHubCreateOrUpdateParameters parameters, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, namespaceName, notificationHubName, - this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context); + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; } /** - * Creates/Update a NotificationHub in a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to the create/update a NotificationHub Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource on successful completion of {@link Mono}. + * The default poll interval for long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String namespaceName, - String notificationHubName, NotificationHubCreateOrUpdateParameters parameters) { - return createOrUpdateWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } + private final Duration defaultPollInterval; /** - * Creates/Update a NotificationHub in a namespace. + * Gets The default poll interval for long-running operation. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to the create/update a NotificationHub Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. + * @return the defaultPollInterval value. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String resourceGroupName, - String namespaceName, String notificationHubName, NotificationHubCreateOrUpdateParameters parameters, - Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters, - context).block(); + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; } /** - * Creates/Update a NotificationHub in a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to the create/update a NotificationHub Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. + * The OperationsClient object to access its operations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NotificationHubResourceInner createOrUpdate(String resourceGroupName, String namespaceName, - String notificationHubName, NotificationHubCreateOrUpdateParameters parameters) { - return createOrUpdateWithResponse(resourceGroupName, namespaceName, notificationHubName, parameters, - Context.NONE).getValue(); - } + private final OperationsClient operations; /** - * Patch a NotificationHub in a namespace. + * Gets the OperationsClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to patch a NotificationHub Resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the OperationsClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, NotificationHubPatchParameters parameters) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters != null) { - parameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.patch(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + public OperationsClient getOperations() { + return this.operations; } /** - * Patch a NotificationHub in a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to patch a NotificationHub Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response} on successful completion of - * {@link Mono}. + * The NotificationHubResourcesClient object to access its operations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, NotificationHubPatchParameters parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters != null) { - parameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.patch(this.client.getEndpoint(), resourceGroupName, namespaceName, notificationHubName, - this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context); - } + private final NotificationHubResourcesClient notificationHubResources; /** - * Patch a NotificationHub in a namespace. + * Gets the NotificationHubResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource on successful completion of {@link Mono}. + * @return the NotificationHubResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono patchAsync(String resourceGroupName, String namespaceName, - String notificationHubName) { - final NotificationHubPatchParameters parameters = null; - return patchWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public NotificationHubResourcesClient getNotificationHubResources() { + return this.notificationHubResources; } /** - * Patch a NotificationHub in a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Parameters supplied to patch a NotificationHub Resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. + * The NamespaceResourcesClient object to access its operations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, NotificationHubPatchParameters parameters, Context context) { - return patchWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters, context) - .block(); - } + private final NamespaceResourcesClient namespaceResources; /** - * Patch a NotificationHub in a namespace. + * Gets the NamespaceResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. + * @return the NamespaceResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NotificationHubResourceInner patch(String resourceGroupName, String namespaceName, - String notificationHubName) { - final NotificationHubPatchParameters parameters = null; - return patchWithResponse(resourceGroupName, namespaceName, notificationHubName, parameters, Context.NONE) - .getValue(); + public NamespaceResourcesClient getNamespaceResources() { + return this.namespaceResources; } /** - * Deletes a notification hub associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * The SharedAccessAuthorizationRuleResourcesClient object to access its operations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String namespaceName, - String notificationHubName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } + private final SharedAccessAuthorizationRuleResourcesClient sharedAccessAuthorizationRuleResources; /** - * Deletes a notification hub associated with a namespace. + * Gets the SharedAccessAuthorizationRuleResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the SharedAccessAuthorizationRuleResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String namespaceName, - String notificationHubName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), resourceGroupName, namespaceName, notificationHubName, - this.client.getApiVersion(), this.client.getSubscriptionId(), context); + public SharedAccessAuthorizationRuleResourcesClient getSharedAccessAuthorizationRuleResources() { + return this.sharedAccessAuthorizationRuleResources; } /** - * Deletes a notification hub associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. + * The NamespacesClient object to access its operations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String namespaceName, String notificationHubName) { - return deleteWithResponseAsync(resourceGroupName, namespaceName, notificationHubName) - .flatMap(ignored -> Mono.empty()); - } + private final NamespacesClient namespaces; /** - * Deletes a notification hub associated with a namespace. + * Gets the NamespacesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return the NamespacesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String namespaceName, String notificationHubName, - Context context) { - return deleteWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, context).block(); + public NamespacesClient getNamespaces() { + return this.namespaces; } /** - * Deletes a notification hub associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * The PrivateEndpointConnectionResourcesClient object to access its operations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String namespaceName, String notificationHubName) { - deleteWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE); - } + private final PrivateEndpointConnectionResourcesClient privateEndpointConnectionResources; /** - * Lists the notification hubs associated with a namespace. + * Gets the PrivateEndpointConnectionResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the PrivateEndpointConnectionResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + public PrivateEndpointConnectionResourcesClient getPrivateEndpointConnectionResources() { + return this.privateEndpointConnectionResources; } /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response} on successful completion of - * {@link Mono}. + * The PrivateLinkResourcesClient object to access its operations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), resourceGroupName, namespaceName, notificationHubName, - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); - } + private final PrivateLinkResourcesClient privateLinkResources; /** - * Lists the notification hubs associated with a namespace. + * Gets the PrivateLinkResourcesClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource on successful completion of {@link Mono}. + * @return the PrivateLinkResourcesClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String namespaceName, - String notificationHubName) { - return getWithResponseAsync(resourceGroupName, namespaceName, notificationHubName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; } /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. + * The NamespacesOperationGroupsClient object to access its operations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Context context) { - return getWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, context).block(); - } + private final NamespacesOperationGroupsClient namespacesOperationGroups; /** - * Lists the notification hubs associated with a namespace. + * Gets the NamespacesOperationGroupsClient object to access its operations. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. + * @return the NamespacesOperationGroupsClient object. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NotificationHubResourceInner get(String resourceGroupName, String namespaceName, - String notificationHubName) { - return getWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE).getValue(); + public NamespacesOperationGroupsClient getNamespacesOperationGroups() { + return this.namespacesOperationGroups; } /** - * test send a push notification. + * Initializes an instance of NotificationHubsClient client. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Debug send parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response} on successful completion of - * {@link Mono}. + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> debugSendWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, Object parameters) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.debugSend(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + NotificationHubsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-10-01-preview"; + this.operations = new OperationsClientImpl(this); + this.notificationHubResources = new NotificationHubResourcesClientImpl(this); + this.namespaceResources = new NamespaceResourcesClientImpl(this); + this.sharedAccessAuthorizationRuleResources = new SharedAccessAuthorizationRuleResourcesClientImpl(this); + this.namespaces = new NamespacesClientImpl(this); + this.privateEndpointConnectionResources = new PrivateEndpointConnectionResourcesClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.namespacesOperationGroups = new NamespacesOperationGroupsClientImpl(this); } /** - * test send a push notification. + * Gets default client context. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Debug send parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the default client context. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> debugSendWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, Object parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.debugSend(this.client.getEndpoint(), resourceGroupName, namespaceName, notificationHubName, - this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context); + public Context getContext() { + return Context.NONE; } /** - * test send a push notification. + * Merges default client context with provided context. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource on successful completion of {@link Mono}. + * @param context the context to be merged with default client context. + * @return the merged context. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono debugSendAsync(String resourceGroupName, String namespaceName, - String notificationHubName) { - final Object parameters = null; - return debugSendWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); } /** - * test send a push notification. + * Gets long running operation result. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Debug send parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response debugSendWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Object parameters, Context context) { - return debugSendWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, parameters, context) - .block(); + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); } /** - * test send a push notification. + * Gets long running operation result. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public DebugSendResponseInner debugSend(String resourceGroupName, String namespaceName, - String notificationHubName) { - final Object parameters = null; - return debugSendWithResponse(resourceGroupName, namespaceName, notificationHubName, parameters, Context.NONE) - .getValue(); - } - - /** - * Creates/Updates an authorization rule for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateAuthorizationRuleWithResponseAsync( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdateAuthorizationRule(this.client.getEndpoint(), - resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, - this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); } /** - * Creates/Updates an authorization rule for a NotificationHub. + * Gets the final result, or an error, based on last async poll response. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules along with {@link Response} on successful completion of - * {@link Mono}. + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateAuthorizationRuleWithResponseAsync( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); } else { - parameters.validate(); + return response.getFinalResult(); } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdateAuthorizationRule(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), - parameters, accept, context); } - /** - * Creates/Updates an authorization rule for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAuthorizationRuleAsync( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { - return createOrUpdateAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; - /** - * Creates/Updates an authorization rule for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateAuthorizationRuleWithResponse( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, Context context) { - return createOrUpdateAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, parameters, context).block(); - } + private final byte[] responseBody; - /** - * Creates/Updates an authorization rule for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { - return createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, parameters, Context.NONE).getValue(); - } + private final HttpHeaders httpHeaders; - /** - * Deletes a notificationHub authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteAuthorizationRuleWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - return FluxUtil - .withContext(context -> service.deleteAuthorizationRule(this.client.getEndpoint(), resourceGroupName, - namespaceName, notificationHubName, authorizationRuleName, this.client.getApiVersion(), - this.client.getSubscriptionId(), context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - /** - * Deletes a notificationHub authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteAuthorizationRuleWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + public int getStatusCode() { + return statusCode; } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - context = this.client.mergeContext(context); - return service.deleteAuthorizationRule(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), - context); - } - - /** - * Deletes a notificationHub authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName) { - return deleteAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName).flatMap(ignored -> Mono.empty()); - } - - /** - * Deletes a notificationHub authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteAuthorizationRuleWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, Context context) { - return deleteAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, context).block(); - } - /** - * Deletes a notificationHub authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, - String authorizationRuleName) { - deleteAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, Context.NONE); - } - - /** - * Gets an authorization rule for a NotificationHub by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a NotificationHub by name along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getAuthorizationRuleWithResponseAsync( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAuthorizationRule(this.client.getEndpoint(), resourceGroupName, - namespaceName, notificationHubName, authorizationRuleName, this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - /** - * Gets an authorization rule for a NotificationHub by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName authorization rule name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a NotificationHub by name along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getAuthorizationRuleWithResponseAsync( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + public HttpHeaders getHeaders() { + return httpHeaders; } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getAuthorizationRule(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), - accept, context); - } - - /** - * Gets an authorization rule for a NotificationHub by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a NotificationHub by name on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAuthorizationRuleAsync(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName) { - return getAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets an authorization rule for a NotificationHub by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName authorization rule name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a NotificationHub by name along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAuthorizationRuleWithResponse( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, - Context context) { - return getAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, context).block(); - } - /** - * Gets an authorization rule for a NotificationHub by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a NotificationHub by name. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName) { - return getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, Context.NONE).getValue(); - } - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String namespaceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), resourceGroupName, namespaceName, - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String namespaceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), resourceGroupName, namespaceName, this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String namespaceName) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, namespaceName), - nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String namespaceName, - Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, namespaceName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String resourceGroupName, String namespaceName) { - return new PagedIterable<>(listAsync(resourceGroupName, namespaceName)); - } - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String resourceGroupName, String namespaceName, - Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, namespaceName, context)); - } - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub along with {@link PagedResponse} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAuthorizationRulesSinglePageAsync( - String resourceGroupName, String namespaceName, String notificationHubName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listAuthorizationRules(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) - .>map( - res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub along with {@link PagedResponse} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAuthorizationRulesSinglePageAsync( - String resourceGroupName, String namespaceName, String notificationHubName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listAuthorizationRules(this.client.getEndpoint(), resourceGroupName, namespaceName, notificationHubName, - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAuthorizationRulesAsync(String resourceGroupName, - String namespaceName, String notificationHubName) { - return new PagedFlux<>( - () -> listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, notificationHubName), - nextLink -> listAuthorizationRulesNextSinglePageAsync(nextLink)); - } - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAuthorizationRulesAsync(String resourceGroupName, - String namespaceName, String notificationHubName, Context context) { - return new PagedFlux<>( - () -> listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, notificationHubName, context), - nextLink -> listAuthorizationRulesNextSinglePageAsync(nextLink, context)); - } - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAuthorizationRules(String resourceGroupName, - String namespaceName, String notificationHubName) { - return new PagedIterable<>(listAuthorizationRulesAsync(resourceGroupName, namespaceName, notificationHubName)); - } - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAuthorizationRules(String resourceGroupName, - String namespaceName, String notificationHubName, Context context) { - return new PagedIterable<>( - listAuthorizationRulesAsync(resourceGroupName, namespaceName, notificationHubName, context)); - } - - /** - * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listKeysWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listKeys(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, authorizationRuleName, this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listKeysWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listKeys(this.client.getEndpoint(), resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); - } - - /** - * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the NotificationHub on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listKeysAsync(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName) { - return listKeysWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listKeysWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, Context context) { - return listKeysWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, - context).block(); - } - - /** - * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the NotificationHub. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResourceListKeysInner listKeys(String resourceGroupName, String namespaceName, String notificationHubName, - String authorizationRuleName) { - return listKeysWithResponse(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, - Context.NONE).getValue(); - } - - /** - * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> regenerateKeysWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, PolicykeyResource parameters) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.regenerateKeys(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, authorizationRuleName, this.client.getApiVersion(), - this.client.getSubscriptionId(), parameters, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> regenerateKeysWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, PolicykeyResource parameters, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (authorizationRuleName == null) { - return Mono - .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.regenerateKeys(this.client.getEndpoint(), resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, - context); - } - - /** - * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono regenerateKeysAsync(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, PolicykeyResource parameters) { - return regenerateKeysWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, PolicykeyResource parameters, Context context) { - return regenerateKeysWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, parameters, context).block(); - } - - /** - * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, PolicykeyResource parameters) { - return regenerateKeysWithResponse(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, - parameters, Context.NONE).getValue(); - } - - /** - * Lists the PNS Credentials associated with a notification hub . - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub PNS Credentials along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getPnsCredentialsWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.getPnsCredentials(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Lists the PNS Credentials associated with a notification hub . - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub PNS Credentials along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getPnsCredentialsWithResponseAsync(String resourceGroupName, - String namespaceName, String notificationHubName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); } - if (namespaceName == null) { - return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); - } - if (notificationHubName == null) { - return Mono - .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getPnsCredentials(this.client.getEndpoint(), resourceGroupName, namespaceName, - notificationHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); - } - - /** - * Lists the PNS Credentials associated with a notification hub . - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub PNS Credentials on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getPnsCredentialsAsync(String resourceGroupName, String namespaceName, - String notificationHubName) { - return getPnsCredentialsWithResponseAsync(resourceGroupName, namespaceName, notificationHubName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Lists the PNS Credentials associated with a notification hub . - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub PNS Credentials along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getPnsCredentialsWithResponse(String resourceGroupName, - String namespaceName, String notificationHubName, Context context) { - return getPnsCredentialsWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, context) - .block(); - } - /** - * Lists the PNS Credentials associated with a notification hub . - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub PNS Credentials. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PnsCredentialsResourceInner getPnsCredentials(String resourceGroupName, String namespaceName, - String notificationHubName) { - return getPnsCredentialsWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE) - .getValue(); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); } - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listAuthorizationRulesNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listAuthorizationRulesNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listAuthorizationRulesNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listAuthorizationRulesNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } + private static final ClientLogger LOGGER = new ClientLogger(NotificationHubsClientImpl.class); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsManagementClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsManagementClientImpl.java deleted file mode 100644 index e4ca71b58dfe..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsManagementClientImpl.java +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.implementation; - -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.notificationhubs.fluent.NamespacesClient; -import com.azure.resourcemanager.notificationhubs.fluent.NotificationHubsClient; -import com.azure.resourcemanager.notificationhubs.fluent.NotificationHubsManagementClient; -import com.azure.resourcemanager.notificationhubs.fluent.OperationsClient; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the NotificationHubsManagementClientImpl type. - */ -@ServiceClient(builder = NotificationHubsManagementClientBuilder.class) -public final class NotificationHubsManagementClientImpl implements NotificationHubsManagementClient { - /** - * Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms - * part of the URI for every service call. - */ - private final String subscriptionId; - - /** - * Gets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID - * forms part of the URI for every service call. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * server parameter. - */ - private final String endpoint; - - /** - * Gets server parameter. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Api Version. - */ - private final String apiVersion; - - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The HTTP pipeline to send requests through. - */ - private final HttpPipeline httpPipeline; - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - public HttpPipeline getHttpPipeline() { - return this.httpPipeline; - } - - /** - * The serializer to serialize an object into a string. - */ - private final SerializerAdapter serializerAdapter; - - /** - * Gets The serializer to serialize an object into a string. - * - * @return the serializerAdapter value. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The OperationsClient object to access its operations. - */ - private final OperationsClient operations; - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - public OperationsClient getOperations() { - return this.operations; - } - - /** - * The NamespacesClient object to access its operations. - */ - private final NamespacesClient namespaces; - - /** - * Gets the NamespacesClient object to access its operations. - * - * @return the NamespacesClient object. - */ - public NamespacesClient getNamespaces() { - return this.namespaces; - } - - /** - * The NotificationHubsClient object to access its operations. - */ - private final NotificationHubsClient notificationHubs; - - /** - * Gets the NotificationHubsClient object to access its operations. - * - * @return the NotificationHubsClient object. - */ - public NotificationHubsClient getNotificationHubs() { - return this.notificationHubs; - } - - /** - * Initializes an instance of NotificationHubsManagementClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param subscriptionId Gets subscription credentials which uniquely identify Microsoft Azure subscription. The - * subscription ID forms part of the URI for every service call. - * @param endpoint server parameter. - */ - NotificationHubsManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.subscriptionId = subscriptionId; - this.endpoint = endpoint; - this.apiVersion = "2017-04-01"; - this.operations = new OperationsClientImpl(this); - this.namespaces = new NamespacesClientImpl(this); - this.notificationHubs = new NotificationHubsClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(NotificationHubsManagementClientImpl.class); -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationImpl.java index f6d3ca9bee4d..7f7484871aa0 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationImpl.java @@ -1,20 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; import com.azure.resourcemanager.notificationhubs.fluent.models.OperationInner; import com.azure.resourcemanager.notificationhubs.models.Operation; import com.azure.resourcemanager.notificationhubs.models.OperationDisplay; +import com.azure.resourcemanager.notificationhubs.models.OperationProperties; public final class OperationImpl implements Operation { private OperationInner innerObject; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; OperationImpl(OperationInner innerObject, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -27,11 +28,19 @@ public OperationDisplay display() { return this.innerModel().display(); } + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationProperties properties() { + return this.innerModel().properties(); + } + public OperationInner innerModel() { return this.innerObject; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationsClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationsClientImpl.java index e80e67761558..1df19683f949 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationsClientImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; @@ -25,9 +25,10 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.notificationhubs.fluent.OperationsClient; import com.azure.resourcemanager.notificationhubs.fluent.models.OperationInner; -import com.azure.resourcemanager.notificationhubs.models.OperationListResult; +import com.azure.resourcemanager.notificationhubs.implementation.models.OperationListResult; import reactor.core.publisher.Mono; /** @@ -42,31 +43,38 @@ public final class OperationsClientImpl implements OperationsClient { /** * The service client containing this operation class. */ - private final NotificationHubsManagementClientImpl client; + private final NotificationHubsClientImpl client; /** * Initializes an instance of OperationsClientImpl. * * @param client the instance of the service client containing this operation class. */ - OperationsClientImpl(NotificationHubsManagementClientImpl client) { + OperationsClientImpl(NotificationHubsClientImpl client) { this.service = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for NotificationHubsManagementClientOperations to be used by the proxy - * service to perform REST calls. + * The interface defining all the services for NotificationHubsClientOperations to be used by the proxy service to + * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "NotificationHubsMana") + @Host("{endpoint}") + @ServiceInterface(name = "NotificationHubsClie") public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.NotificationHubs/operations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.NotificationHubs/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -74,16 +82,23 @@ Mono> list(@HostParam("$host") String endpoint, @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return paged collection of Operation items along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -101,81 +116,85 @@ private Mono> listSinglePageAsync() { } /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return paged collection of Operation items as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations as paginated response with {@link PagedFlux}. + * @return paged collection of Operation items along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations as paginated response with {@link PagedFlux}. + * @return paged collection of Operation items along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations as paginated response with - * {@link PagedIterable}. + * @return paged collection of Operation items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations as paginated response with - * {@link PagedIterable}. + * @return paged collection of Operation items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -185,8 +204,8 @@ public PagedIterable list(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return paged collection of Operation items along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -204,6 +223,33 @@ private Mono> listNextSinglePageAsync(String nextL .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Operation items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -212,22 +258,24 @@ private Mono> listNextSinglePageAsync(String nextL * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return paged collection of Operation items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(OperationsClientImpl.class); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationsImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationsImpl.java index 9f63228665c3..e7ac5fcfea7c 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationsImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/OperationsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; @@ -17,10 +17,10 @@ public final class OperationsImpl implements Operations { private final OperationsClient innerClient; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; public OperationsImpl(OperationsClient innerClient, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -39,7 +39,7 @@ private OperationsClient serviceClient() { return this.innerClient; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PnsCredentialsResourceImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PnsCredentialsResourceImpl.java index ae11032396c2..773fda57abd0 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PnsCredentialsResourceImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PnsCredentialsResourceImpl.java @@ -1,28 +1,31 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; import com.azure.resourcemanager.notificationhubs.models.AdmCredential; import com.azure.resourcemanager.notificationhubs.models.ApnsCredential; import com.azure.resourcemanager.notificationhubs.models.BaiduCredential; +import com.azure.resourcemanager.notificationhubs.models.BrowserCredential; +import com.azure.resourcemanager.notificationhubs.models.FcmV1Credential; import com.azure.resourcemanager.notificationhubs.models.GcmCredential; import com.azure.resourcemanager.notificationhubs.models.MpnsCredential; import com.azure.resourcemanager.notificationhubs.models.PnsCredentialsResource; -import com.azure.resourcemanager.notificationhubs.models.Sku; import com.azure.resourcemanager.notificationhubs.models.WnsCredential; +import com.azure.resourcemanager.notificationhubs.models.XiaomiCredential; import java.util.Collections; import java.util.Map; public final class PnsCredentialsResourceImpl implements PnsCredentialsResource { private PnsCredentialsResourceInner innerObject; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; PnsCredentialsResourceImpl(PnsCredentialsResourceInner innerObject, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -52,16 +55,24 @@ public Map tags() { } } - public Sku sku() { - return this.innerModel().sku(); + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AdmCredential admCredential() { + return this.innerModel().admCredential(); } public ApnsCredential apnsCredential() { return this.innerModel().apnsCredential(); } - public WnsCredential wnsCredential() { - return this.innerModel().wnsCredential(); + public BaiduCredential baiduCredential() { + return this.innerModel().baiduCredential(); + } + + public BrowserCredential browserCredential() { + return this.innerModel().browserCredential(); } public GcmCredential gcmCredential() { @@ -72,19 +83,23 @@ public MpnsCredential mpnsCredential() { return this.innerModel().mpnsCredential(); } - public AdmCredential admCredential() { - return this.innerModel().admCredential(); + public WnsCredential wnsCredential() { + return this.innerModel().wnsCredential(); } - public BaiduCredential baiduCredential() { - return this.innerModel().baiduCredential(); + public XiaomiCredential xiaomiCredential() { + return this.innerModel().xiaomiCredential(); + } + + public FcmV1Credential fcmV1Credential() { + return this.innerModel().fcmV1Credential(); } public PnsCredentialsResourceInner innerModel() { return this.innerObject; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateEndpointConnectionResourceImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateEndpointConnectionResourceImpl.java new file mode 100644 index 000000000000..3a7a3d3348f9 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateEndpointConnectionResourceImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.notificationhubs.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.notificationhubs.models.PrivateEndpointConnectionResource; + +public final class PrivateEndpointConnectionResourceImpl implements PrivateEndpointConnectionResource { + private PrivateEndpointConnectionResourceInner innerObject; + + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; + + PrivateEndpointConnectionResourceImpl(PrivateEndpointConnectionResourceInner innerObject, + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointConnectionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public PrivateEndpointConnectionResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateEndpointConnectionResourcesClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateEndpointConnectionResourcesClientImpl.java new file mode 100644 index 000000000000..d5a5489002ee --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateEndpointConnectionResourcesClientImpl.java @@ -0,0 +1,1097 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.notificationhubs.fluent.PrivateEndpointConnectionResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.notificationhubs.implementation.models.PrivateEndpointConnectionResourceListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionResourcesClient. + */ +public final class PrivateEndpointConnectionResourcesClientImpl implements PrivateEndpointConnectionResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateEndpointConnectionResourcesService service; + + /** + * The service client containing this operation class. + */ + private final NotificationHubsClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionResourcesClientImpl(NotificationHubsClientImpl client) { + this.service = RestProxy.create(PrivateEndpointConnectionResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NotificationHubsClientPrivateEndpointConnectionResources to be used + * by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NotificationHubsClie") + public interface PrivateEndpointConnectionResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PrivateEndpointConnectionResourceInner parameters, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PrivateEndpointConnectionResourceInner parameters, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a Private Endpoint Connection with a given name. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String namespaceName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, privateEndpointConnectionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a Private Endpoint Connection with a given name. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, namespaceName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a Private Endpoint Connection with a given name. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String namespaceName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, namespaceName, privateEndpointConnectionName, accept, context); + } + + /** + * Returns a Private Endpoint Connection with a given name. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionResourceInner get(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, namespaceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, privateEndpointConnectionName, + contentType, accept, parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, privateEndpointConnectionName, + contentType, accept, parameters, Context.NONE); + } + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, privateEndpointConnectionName, + contentType, accept, parameters, context); + } + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Private Endpoint Connection ARM resource - a + * sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionResourceInner> + beginUpdateAsync(String resourceGroupName, String namespaceName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner parameters) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), PrivateEndpointConnectionResourceInner.class, + PrivateEndpointConnectionResourceInner.class, this.client.getContext()); + } + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Private Endpoint Connection ARM resource - a + * sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionResourceInner> + beginUpdate(String resourceGroupName, String namespaceName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner parameters) { + Response response + = updateWithResponse(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters); + return this.client.getLroResult( + response, PrivateEndpointConnectionResourceInner.class, PrivateEndpointConnectionResourceInner.class, + Context.NONE); + } + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Private Endpoint Connection ARM resource - a + * sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionResourceInner> + beginUpdate(String resourceGroupName, String namespaceName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner parameters, Context context) { + Response response + = updateWithResponse(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters, context); + return this.client.getLroResult( + response, PrivateEndpointConnectionResourceInner.class, PrivateEndpointConnectionResourceInner.class, + context); + } + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters) { + return beginUpdateAsync(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionResourceInner update(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters) { + return beginUpdate(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters) + .getFinalResult(); + } + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionResourceInner update(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters, Context context) { + return beginUpdate(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters, context) + .getFinalResult(); + } + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, privateEndpointConnectionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, privateEndpointConnectionName, accept, + Context.NONE); + } + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, privateEndpointConnectionName, accept, + context); + } + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, namespaceName, privateEndpointConnectionName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName) { + Response response + = deleteWithResponse(resourceGroupName, namespaceName, privateEndpointConnectionName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, namespaceName, privateEndpointConnectionName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, namespaceName, privateEndpointConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String namespaceName, String privateEndpointConnectionName) { + beginDelete(resourceGroupName, namespaceName, privateEndpointConnectionName).getFinalResult(); + } + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String namespaceName, String privateEndpointConnectionName, + Context context) { + beginDelete(resourceGroupName, namespaceName, privateEndpointConnectionName, context).getFinalResult(); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String namespaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String namespaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, namespaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String namespaceName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, namespaceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String namespaceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, namespaceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String namespaceName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, namespaceName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String namespaceName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, namespaceName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionResourcesClientImpl.class); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateEndpointConnectionResourcesImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateEndpointConnectionResourcesImpl.java new file mode 100644 index 000000000000..db754250f7c1 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateEndpointConnectionResourcesImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.notificationhubs.fluent.PrivateEndpointConnectionResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.notificationhubs.models.PrivateEndpointConnectionResource; +import com.azure.resourcemanager.notificationhubs.models.PrivateEndpointConnectionResources; + +public final class PrivateEndpointConnectionResourcesImpl implements PrivateEndpointConnectionResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionResourcesImpl.class); + + private final PrivateEndpointConnectionResourcesClient innerClient; + + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; + + public PrivateEndpointConnectionResourcesImpl(PrivateEndpointConnectionResourcesClient innerClient, + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, namespaceName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateEndpointConnectionResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnectionResource get(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName) { + PrivateEndpointConnectionResourceInner inner + = this.serviceClient().get(resourceGroupName, namespaceName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnectionResource update(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters) { + PrivateEndpointConnectionResourceInner inner + = this.serviceClient().update(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters); + if (inner != null) { + return new PrivateEndpointConnectionResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnectionResource update(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters, Context context) { + PrivateEndpointConnectionResourceInner inner = this.serviceClient() + .update(resourceGroupName, namespaceName, privateEndpointConnectionName, parameters, context); + if (inner != null) { + return new PrivateEndpointConnectionResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String namespaceName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, namespaceName, privateEndpointConnectionName); + } + + public void delete(String resourceGroupName, String namespaceName, String privateEndpointConnectionName, + Context context) { + this.serviceClient().delete(resourceGroupName, namespaceName, privateEndpointConnectionName, context); + } + + public PagedIterable list(String resourceGroupName, String namespaceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, namespaceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PrivateEndpointConnectionResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String namespaceName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, namespaceName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PrivateEndpointConnectionResourceImpl(inner1, this.manager())); + } + + private PrivateEndpointConnectionResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateLinkResourceImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 000000000000..b6a3597ea761 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.notificationhubs.models.PrivateLinkResource; +import com.azure.resourcemanager.notificationhubs.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; + + PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateLinkResourcesClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..2d729bc5b3ce --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,517 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.notificationhubs.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.notificationhubs.implementation.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final NotificationHubsClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(NotificationHubsClientImpl client) { + this.service = RestProxy.create(PrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NotificationHubsClientPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NotificationHubsClie") + public interface PrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGroupId(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("subResourceName") String subResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources/{subResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getGroupIdSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("subResourceName") String subResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listGroupIds(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listGroupIdsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listGroupIdsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listGroupIdsNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param subResourceName Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Private Link Arm Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGroupIdWithResponseAsync(String resourceGroupName, + String namespaceName, String subResourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (subResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter subResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getGroupId(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, subResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param subResourceName Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Private Link Arm Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGroupIdAsync(String resourceGroupName, String namespaceName, + String subResourceName) { + return getGroupIdWithResponseAsync(resourceGroupName, namespaceName, subResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param subResourceName Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Private Link Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGroupIdWithResponse(String resourceGroupName, String namespaceName, + String subResourceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (subResourceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter subResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getGroupIdSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, subResourceName, accept, context); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param subResourceName Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Private Link Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner getGroupId(String resourceGroupName, String namespaceName, String subResourceName) { + return getGroupIdWithResponse(resourceGroupName, namespaceName, subResourceName, Context.NONE).getValue(); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGroupIdsSinglePageAsync(String resourceGroupName, + String namespaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listGroupIds(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGroupIdsAsync(String resourceGroupName, String namespaceName) { + return new PagedFlux<>(() -> listGroupIdsSinglePageAsync(resourceGroupName, namespaceName), + nextLink -> listGroupIdsNextSinglePageAsync(nextLink)); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listGroupIdsSinglePage(String resourceGroupName, + String namespaceName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listGroupIdsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listGroupIdsSinglePage(String resourceGroupName, + String namespaceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listGroupIdsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGroupIds(String resourceGroupName, String namespaceName) { + return new PagedIterable<>(() -> listGroupIdsSinglePage(resourceGroupName, namespaceName), + nextLink -> listGroupIdsNextSinglePage(nextLink)); + } + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGroupIds(String resourceGroupName, String namespaceName, + Context context) { + return new PagedIterable<>(() -> listGroupIdsSinglePage(resourceGroupName, namespaceName, context), + nextLink -> listGroupIdsNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGroupIdsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listGroupIdsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listGroupIdsNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listGroupIdsNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listGroupIdsNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listGroupIdsNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesClientImpl.class); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateLinkResourcesImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..9bd99f645a9e --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.notificationhubs.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.notificationhubs.models.PrivateLinkResource; +import com.azure.resourcemanager.notificationhubs.models.PrivateLinkResources; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; + + public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getGroupIdWithResponse(String resourceGroupName, String namespaceName, + String subResourceName, Context context) { + Response inner + = this.serviceClient().getGroupIdWithResponse(resourceGroupName, namespaceName, subResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateLinkResource getGroupId(String resourceGroupName, String namespaceName, String subResourceName) { + PrivateLinkResourceInner inner + = this.serviceClient().getGroupId(resourceGroupName, namespaceName, subResourceName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listGroupIds(String resourceGroupName, String namespaceName) { + PagedIterable inner + = this.serviceClient().listGroupIds(resourceGroupName, namespaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listGroupIds(String resourceGroupName, String namespaceName, + Context context) { + PagedIterable inner + = this.serviceClient().listGroupIds(resourceGroupName, namespaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/ResourceListKeysImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/ResourceListKeysImpl.java index da8404016e1f..0034142b4f01 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/ResourceListKeysImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/ResourceListKeysImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; @@ -10,10 +10,10 @@ public final class ResourceListKeysImpl implements ResourceListKeys { private ResourceListKeysInner innerObject; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; ResourceListKeysImpl(ResourceListKeysInner innerObject, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -42,7 +42,7 @@ public ResourceListKeysInner innerModel() { return this.innerObject; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/ResourceManagerUtils.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/ResourceManagerUtils.java index d5b88618cdef..f3617c6d930b 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/ResourceManagerUtils.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/ResourceManagerUtils.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourceImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourceImpl.java index 2bd747f22082..7c48bbade229 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourceImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourceImpl.java @@ -1,20 +1,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; import com.azure.resourcemanager.notificationhubs.models.AccessRights; -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; +import com.azure.resourcemanager.notificationhubs.models.PolicyKeyResource; import com.azure.resourcemanager.notificationhubs.models.ResourceListKeys; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters; import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleResource; -import com.azure.resourcemanager.notificationhubs.models.Sku; +import java.time.OffsetDateTime; import java.util.Collections; import java.util.List; import java.util.Map; @@ -23,7 +22,7 @@ public final class SharedAccessAuthorizationRuleResourceImpl implements SharedAc SharedAccessAuthorizationRuleResource.Definition, SharedAccessAuthorizationRuleResource.Update { private SharedAccessAuthorizationRuleResourceInner innerObject; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; public String id() { return this.innerModel().id(); @@ -50,8 +49,8 @@ public Map tags() { } } - public Sku sku() { - return this.innerModel().sku(); + public SystemData systemData() { + return this.innerModel().systemData(); } public List rights() { @@ -75,20 +74,20 @@ public String keyName() { return this.innerModel().keyName(); } - public String claimType() { - return this.innerModel().claimType(); + public OffsetDateTime modifiedTime() { + return this.innerModel().modifiedTime(); } - public String claimValue() { - return this.innerModel().claimValue(); + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); } - public String modifiedTime() { - return this.innerModel().modifiedTime(); + public String claimType() { + return this.innerModel().claimType(); } - public String createdTime() { - return this.innerModel().createdTime(); + public String claimValue() { + return this.innerModel().claimValue(); } public Integer revision() { @@ -111,7 +110,7 @@ public SharedAccessAuthorizationRuleResourceInner innerModel() { return this.innerObject; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } @@ -119,124 +118,142 @@ private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manag private String namespaceName; - private String authorizationRuleName; - - private SharedAccessAuthorizationRuleCreateOrUpdateParameters createParameters; + private String notificationHubName; - private SharedAccessAuthorizationRuleCreateOrUpdateParameters updateParameters; + private String authorizationRuleName; - public SharedAccessAuthorizationRuleResourceImpl withExistingNamespace(String resourceGroupName, - String namespaceName) { + public SharedAccessAuthorizationRuleResourceImpl withExistingNotificationHub(String resourceGroupName, + String namespaceName, String notificationHubName) { this.resourceGroupName = resourceGroupName; this.namespaceName = namespaceName; + this.notificationHubName = notificationHubName; return this; } public SharedAccessAuthorizationRuleResource create() { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, - createParameters, Context.NONE) + .getSharedAccessAuthorizationRuleResources() + .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, this.innerModel(), Context.NONE) .getValue(); return this; } public SharedAccessAuthorizationRuleResource create(Context context) { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, - createParameters, context) + .getSharedAccessAuthorizationRuleResources() + .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, this.innerModel(), context) .getValue(); return this; } SharedAccessAuthorizationRuleResourceImpl(String name, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = new SharedAccessAuthorizationRuleResourceInner(); this.serviceManager = serviceManager; this.authorizationRuleName = name; - this.createParameters = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); } public SharedAccessAuthorizationRuleResourceImpl update() { - this.updateParameters = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); return this; } public SharedAccessAuthorizationRuleResource apply() { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, - updateParameters, Context.NONE) + .getSharedAccessAuthorizationRuleResources() + .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, this.innerModel(), Context.NONE) .getValue(); return this; } public SharedAccessAuthorizationRuleResource apply(Context context) { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, - updateParameters, context) + .getSharedAccessAuthorizationRuleResources() + .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, this.innerModel(), context) .getValue(); return this; } SharedAccessAuthorizationRuleResourceImpl(SharedAccessAuthorizationRuleResourceInner innerObject, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); this.namespaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "namespaces"); - this.authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "AuthorizationRules"); + this.notificationHubName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "notificationHubs"); + this.authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "authorizationRules"); } public SharedAccessAuthorizationRuleResource refresh() { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, Context.NONE) + .getSharedAccessAuthorizationRuleResources() + .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, Context.NONE) .getValue(); return this; } public SharedAccessAuthorizationRuleResource refresh(Context context) { this.innerObject = serviceManager.serviceClient() - .getNamespaces() - .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, authorizationRuleName, context) + .getSharedAccessAuthorizationRuleResources() + .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, context) .getValue(); return this; } public Response listKeysWithResponse(Context context) { - return serviceManager.namespaces() - .listKeysWithResponse(resourceGroupName, namespaceName, authorizationRuleName, context); + return serviceManager.sharedAccessAuthorizationRuleResources() + .listKeysWithResponse(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, + context); } public ResourceListKeys listKeys() { - return serviceManager.namespaces().listKeys(resourceGroupName, namespaceName, authorizationRuleName); + return serviceManager.sharedAccessAuthorizationRuleResources() + .listKeys(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); } - public Response regenerateKeysWithResponse(PolicykeyResource parameters, Context context) { - return serviceManager.namespaces() - .regenerateKeysWithResponse(resourceGroupName, namespaceName, authorizationRuleName, parameters, context); + public Response regenerateKeysWithResponse(PolicyKeyResource parameters, Context context) { + return serviceManager.sharedAccessAuthorizationRuleResources() + .regenerateKeysWithResponse(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, + parameters, context); } - public ResourceListKeys regenerateKeys(PolicykeyResource parameters) { - return serviceManager.namespaces() - .regenerateKeys(resourceGroupName, namespaceName, authorizationRuleName, parameters); + public ResourceListKeys regenerateKeys(PolicyKeyResource parameters) { + return serviceManager.sharedAccessAuthorizationRuleResources() + .regenerateKeys(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters); } - public SharedAccessAuthorizationRuleResourceImpl - withProperties(SharedAccessAuthorizationRuleProperties properties) { - if (isInCreateMode()) { - this.createParameters.withProperties(properties); - return this; - } else { - this.updateParameters.withProperties(properties); - return this; - } + public SharedAccessAuthorizationRuleResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SharedAccessAuthorizationRuleResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SharedAccessAuthorizationRuleResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; } - private boolean isInCreateMode() { - return this.innerModel().id() == null; + public SharedAccessAuthorizationRuleResourceImpl withRights(List rights) { + this.innerModel().withRights(rights); + return this; + } + + public SharedAccessAuthorizationRuleResourceImpl withPrimaryKey(String primaryKey) { + this.innerModel().withPrimaryKey(primaryKey); + return this; + } + + public SharedAccessAuthorizationRuleResourceImpl withSecondaryKey(String secondaryKey) { + this.innerModel().withSecondaryKey(secondaryKey); + return this; } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourcesClientImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourcesClientImpl.java new file mode 100644 index 000000000000..27259dc0ab31 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourcesClientImpl.java @@ -0,0 +1,1213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.notificationhubs.fluent.SharedAccessAuthorizationRuleResourcesClient; +import com.azure.resourcemanager.notificationhubs.fluent.models.ResourceListKeysInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; +import com.azure.resourcemanager.notificationhubs.implementation.models.SharedAccessAuthorizationRuleListResult; +import com.azure.resourcemanager.notificationhubs.models.PolicyKeyResource; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SharedAccessAuthorizationRuleResourcesClient. + */ +public final class SharedAccessAuthorizationRuleResourcesClientImpl + implements SharedAccessAuthorizationRuleResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SharedAccessAuthorizationRuleResourcesService service; + + /** + * The service client containing this operation class. + */ + private final NotificationHubsClientImpl client; + + /** + * Initializes an instance of SharedAccessAuthorizationRuleResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SharedAccessAuthorizationRuleResourcesClientImpl(NotificationHubsClientImpl client) { + this.service = RestProxy.create(SharedAccessAuthorizationRuleResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NotificationHubsClientSharedAccessAuthorizationRuleResources to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NotificationHubsClie") + public interface SharedAccessAuthorizationRuleResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAuthorizationRule( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getAuthorizationRuleSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdateAuthorizationRule( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SharedAccessAuthorizationRuleResourceInner parameters, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateAuthorizationRuleSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SharedAccessAuthorizationRuleResourceInner parameters, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteAuthorizationRule(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteAuthorizationRuleSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAuthorizationRules( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAuthorizationRulesSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}/listKeys") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listKeys(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}/listKeys") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listKeysSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> regenerateKeys(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PolicyKeyResource parameters, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response regenerateKeysSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName, + @PathParam("notificationHubName") String notificationHubName, + @PathParam("authorizationRuleName") String authorizationRuleName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PolicyKeyResource parameters, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAuthorizationRulesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAuthorizationRulesNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAuthorizationRuleWithResponseAsync( + String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAuthorizationRule(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAuthorizationRuleAsync(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName) { + return getAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAuthorizationRuleWithResponse( + String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getAuthorizationRuleSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, accept, context); + } + + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedAccessAuthorizationRuleResourceInner getAuthorizationRule(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName) { + return getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, Context.NONE).getValue(); + } + + /** + * Creates/Updates an authorization rule for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for POST requests that return single SharedAccessAuthorizationRule along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAuthorizationRuleWithResponseAsync( + String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdateAuthorizationRule(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, namespaceName, + notificationHubName, authorizationRuleName, contentType, accept, parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates/Updates an authorization rule for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for POST requests that return single SharedAccessAuthorizationRule on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAuthorizationRuleAsync( + String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters) { + return createOrUpdateAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates/Updates an authorization rule for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for POST requests that return single SharedAccessAuthorizationRule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateAuthorizationRuleWithResponse( + String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateAuthorizationRuleSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, contentType, accept, parameters, context); + } + + /** + * Creates/Updates an authorization rule for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for POST requests that return single SharedAccessAuthorizationRule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters) { + return createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, parameters, Context.NONE).getValue(); + } + + /** + * Deletes a notificationHub authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAuthorizationRuleWithResponseAsync(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.deleteAuthorizationRule(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, namespaceName, + notificationHubName, authorizationRuleName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a notificationHub authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName) { + return deleteAuthorizationRuleWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a notificationHub authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAuthorizationRuleWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteAuthorizationRuleSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, accept, context); + } + + /** + * Deletes a notificationHub authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, + String authorizationRuleName) { + deleteAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, Context.NONE); + } + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAuthorizationRulesSinglePageAsync( + String resourceGroupName, String namespaceName, String notificationHubName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAuthorizationRules(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, namespaceName, + notificationHubName, accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAuthorizationRulesAsync(String resourceGroupName, + String namespaceName, String notificationHubName) { + return new PagedFlux<>( + () -> listAuthorizationRulesSinglePageAsync(resourceGroupName, namespaceName, notificationHubName), + nextLink -> listAuthorizationRulesNextSinglePageAsync(nextLink)); + } + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse + listAuthorizationRulesSinglePage(String resourceGroupName, String namespaceName, String notificationHubName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listAuthorizationRulesSync( + this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + namespaceName, notificationHubName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAuthorizationRulesSinglePage( + String resourceGroupName, String namespaceName, String notificationHubName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listAuthorizationRulesSync( + this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + namespaceName, notificationHubName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAuthorizationRules(String resourceGroupName, + String namespaceName, String notificationHubName) { + return new PagedIterable<>( + () -> listAuthorizationRulesSinglePage(resourceGroupName, namespaceName, notificationHubName), + nextLink -> listAuthorizationRulesNextSinglePage(nextLink)); + } + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAuthorizationRules(String resourceGroupName, + String namespaceName, String notificationHubName, Context context) { + return new PagedIterable<>( + () -> listAuthorizationRulesSinglePage(resourceGroupName, namespaceName, notificationHubName, context), + nextLink -> listAuthorizationRulesNextSinglePage(nextLink, context)); + } + + /** + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listKeys(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysAsync(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName) { + return listKeysWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.listKeysSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, accept, context); + } + + /** + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceListKeysInner listKeys(String resourceGroupName, String namespaceName, String notificationHubName, + String authorizationRuleName) { + return listKeysWithResponse(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, + Context.NONE).getValue(); + } + + /** + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeysWithResponseAsync(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName, PolicyKeyResource parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.regenerateKeys(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, contentType, accept, parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeysAsync(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, PolicyKeyResource parameters) { + return regenerateKeysWithResponseAsync(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, PolicyKeyResource parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (namespaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); + } + if (notificationHubName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter notificationHubName is required and cannot be null.")); + } + if (authorizationRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter authorizationRuleName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.regenerateKeysSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, contentType, accept, parameters, context); + } + + /** + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceListKeysInner regenerateKeys(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, PolicyKeyResource parameters) { + return regenerateKeysWithResponse(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, + parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of SharedAccessAuthorizationRuleResource items along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listAuthorizationRulesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listAuthorizationRulesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of SharedAccessAuthorizationRuleResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse + listAuthorizationRulesNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAuthorizationRulesNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of SharedAccessAuthorizationRuleResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse + listAuthorizationRulesNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAuthorizationRulesNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(SharedAccessAuthorizationRuleResourcesClientImpl.class); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsImpl.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourcesImpl.java similarity index 53% rename from sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsImpl.java rename to sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourcesImpl.java index b3ff3545038f..ae24fe976606 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/NotificationHubsImpl.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/SharedAccessAuthorizationRuleResourcesImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.implementation; @@ -9,119 +9,32 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.notificationhubs.fluent.NotificationHubsClient; -import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubResourceInner; -import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; +import com.azure.resourcemanager.notificationhubs.fluent.SharedAccessAuthorizationRuleResourcesClient; import com.azure.resourcemanager.notificationhubs.fluent.models.ResourceListKeysInner; import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityResult; -import com.azure.resourcemanager.notificationhubs.models.DebugSendResponse; -import com.azure.resourcemanager.notificationhubs.models.NotificationHubResource; -import com.azure.resourcemanager.notificationhubs.models.NotificationHubs; -import com.azure.resourcemanager.notificationhubs.models.PnsCredentialsResource; -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; +import com.azure.resourcemanager.notificationhubs.models.PolicyKeyResource; import com.azure.resourcemanager.notificationhubs.models.ResourceListKeys; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters; import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleResource; +import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleResources; -public final class NotificationHubsImpl implements NotificationHubs { - private static final ClientLogger LOGGER = new ClientLogger(NotificationHubsImpl.class); +public final class SharedAccessAuthorizationRuleResourcesImpl implements SharedAccessAuthorizationRuleResources { + private static final ClientLogger LOGGER = new ClientLogger(SharedAccessAuthorizationRuleResourcesImpl.class); - private final NotificationHubsClient innerClient; + private final SharedAccessAuthorizationRuleResourcesClient innerClient; - private final com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager; + private final com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager; - public NotificationHubsImpl(NotificationHubsClient innerClient, - com.azure.resourcemanager.notificationhubs.NotificationHubsManager serviceManager) { + public SharedAccessAuthorizationRuleResourcesImpl(SharedAccessAuthorizationRuleResourcesClient innerClient, + com.azure.resourcemanager.notificationhubs.NotificationhubsManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } - public Response checkNotificationHubAvailabilityWithResponse(String resourceGroupName, - String namespaceName, CheckAvailabilityParameters parameters, Context context) { - Response inner = this.serviceClient() - .checkNotificationHubAvailabilityWithResponse(resourceGroupName, namespaceName, parameters, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new CheckAvailabilityResultImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public CheckAvailabilityResult checkNotificationHubAvailability(String resourceGroupName, String namespaceName, - CheckAvailabilityParameters parameters) { - CheckAvailabilityResultInner inner - = this.serviceClient().checkNotificationHubAvailability(resourceGroupName, namespaceName, parameters); - if (inner != null) { - return new CheckAvailabilityResultImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteWithResponse(String resourceGroupName, String namespaceName, String notificationHubName, - Context context) { - return this.serviceClient().deleteWithResponse(resourceGroupName, namespaceName, notificationHubName, context); - } - - public void delete(String resourceGroupName, String namespaceName, String notificationHubName) { - this.serviceClient().delete(resourceGroupName, namespaceName, notificationHubName); - } - - public Response getWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Context context) { - Response inner - = this.serviceClient().getWithResponse(resourceGroupName, namespaceName, notificationHubName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new NotificationHubResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public NotificationHubResource get(String resourceGroupName, String namespaceName, String notificationHubName) { - NotificationHubResourceInner inner - = this.serviceClient().get(resourceGroupName, namespaceName, notificationHubName); - if (inner != null) { - return new NotificationHubResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response debugSendWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Object parameters, Context context) { - Response inner = this.serviceClient() - .debugSendWithResponse(resourceGroupName, namespaceName, notificationHubName, parameters, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new DebugSendResponseImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public DebugSendResponse debugSend(String resourceGroupName, String namespaceName, String notificationHubName) { - DebugSendResponseInner inner - = this.serviceClient().debugSend(resourceGroupName, namespaceName, notificationHubName); - if (inner != null) { - return new DebugSendResponseImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response createOrUpdateAuthorizationRuleWithResponse( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, Context context) { + public Response getAuthorizationRuleWithResponse(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName, Context context) { Response inner = this.serviceClient() - .createOrUpdateAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, parameters, context); + .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new SharedAccessAuthorizationRuleResourceImpl(inner.getValue(), this.manager())); @@ -130,12 +43,10 @@ public Response createOrUpdateAuthorizati } } - public SharedAccessAuthorizationRuleResource createOrUpdateAuthorizationRule(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters) { + public SharedAccessAuthorizationRuleResource getAuthorizationRule(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName) { SharedAccessAuthorizationRuleResourceInner inner = this.serviceClient() - .createOrUpdateAuthorizationRule(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, parameters); + .getAuthorizationRule(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); if (inner != null) { return new SharedAccessAuthorizationRuleResourceImpl(inner, this.manager()); } else { @@ -156,42 +67,6 @@ public void deleteAuthorizationRule(String resourceGroupName, String namespaceNa .deleteAuthorizationRule(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); } - public Response getAuthorizationRuleWithResponse(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, Context context) { - Response inner = this.serviceClient() - .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, - authorizationRuleName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SharedAccessAuthorizationRuleResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SharedAccessAuthorizationRuleResource getAuthorizationRule(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName) { - SharedAccessAuthorizationRuleResourceInner inner = this.serviceClient() - .getAuthorizationRule(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName); - if (inner != null) { - return new SharedAccessAuthorizationRuleResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public PagedIterable list(String resourceGroupName, String namespaceName) { - PagedIterable inner = this.serviceClient().list(resourceGroupName, namespaceName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new NotificationHubResourceImpl(inner1, this.manager())); - } - - public PagedIterable list(String resourceGroupName, String namespaceName, - Context context) { - PagedIterable inner - = this.serviceClient().list(resourceGroupName, namespaceName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new NotificationHubResourceImpl(inner1, this.manager())); - } - public PagedIterable listAuthorizationRules(String resourceGroupName, String namespaceName, String notificationHubName) { PagedIterable inner @@ -233,7 +108,7 @@ public ResourceListKeys listKeys(String resourceGroupName, String namespaceName, } public Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, PolicykeyResource parameters, Context context) { + String notificationHubName, String authorizationRuleName, PolicyKeyResource parameters, Context context) { Response inner = this.serviceClient() .regenerateKeysWithResponse(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters, context); @@ -246,7 +121,7 @@ public Response regenerateKeysWithResponse(String resourceGrou } public ResourceListKeys regenerateKeys(String resourceGroupName, String namespaceName, String notificationHubName, - String authorizationRuleName, PolicykeyResource parameters) { + String authorizationRuleName, PolicyKeyResource parameters) { ResourceListKeysInner inner = this.serviceClient() .regenerateKeys(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters); if (inner != null) { @@ -256,30 +131,7 @@ public ResourceListKeys regenerateKeys(String resourceGroupName, String namespac } } - public Response getPnsCredentialsWithResponse(String resourceGroupName, - String namespaceName, String notificationHubName, Context context) { - Response inner = this.serviceClient() - .getPnsCredentialsWithResponse(resourceGroupName, namespaceName, notificationHubName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new PnsCredentialsResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public PnsCredentialsResource getPnsCredentials(String resourceGroupName, String namespaceName, - String notificationHubName) { - PnsCredentialsResourceInner inner - = this.serviceClient().getPnsCredentials(resourceGroupName, namespaceName, notificationHubName); - if (inner != null) { - return new PnsCredentialsResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public NotificationHubResource getById(String id) { + public SharedAccessAuthorizationRuleResource getAuthorizationRuleById(String id) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( @@ -295,10 +147,19 @@ public NotificationHubResource getById(String id) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'notificationHubs'.", id))); } - return this.getWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE).getValue(); + String authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(id, "authorizationRules"); + if (authorizationRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'authorizationRules'.", id))); + } + return this + .getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, Context.NONE) + .getValue(); } - public Response getByIdWithResponse(String id, Context context) { + public Response getAuthorizationRuleByIdWithResponse(String id, + Context context) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( @@ -314,10 +175,16 @@ public Response getByIdWithResponse(String id, Context throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'notificationHubs'.", id))); } - return this.getWithResponse(resourceGroupName, namespaceName, notificationHubName, context); + String authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(id, "authorizationRules"); + if (authorizationRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'authorizationRules'.", id))); + } + return this.getAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, context); } - public void deleteById(String id) { + public void deleteAuthorizationRuleById(String id) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( @@ -333,10 +200,16 @@ public void deleteById(String id) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'notificationHubs'.", id))); } - this.deleteWithResponse(resourceGroupName, namespaceName, notificationHubName, Context.NONE); + String authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(id, "authorizationRules"); + if (authorizationRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'authorizationRules'.", id))); + } + this.deleteAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, Context.NONE); } - public Response deleteByIdWithResponse(String id, Context context) { + public Response deleteAuthorizationRuleByIdWithResponse(String id, Context context) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( @@ -352,18 +225,24 @@ public Response deleteByIdWithResponse(String id, Context context) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'notificationHubs'.", id))); } - return this.deleteWithResponse(resourceGroupName, namespaceName, notificationHubName, context); + String authorizationRuleName = ResourceManagerUtils.getValueFromIdByName(id, "authorizationRules"); + if (authorizationRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'authorizationRules'.", id))); + } + return this.deleteAuthorizationRuleWithResponse(resourceGroupName, namespaceName, notificationHubName, + authorizationRuleName, context); } - private NotificationHubsClient serviceClient() { + private SharedAccessAuthorizationRuleResourcesClient serviceClient() { return this.innerClient; } - private com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager() { + private com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager() { return this.serviceManager; } - public NotificationHubResourceImpl define(String name) { - return new NotificationHubResourceImpl(name, this.manager()); + public SharedAccessAuthorizationRuleResourceImpl define(String name) { + return new SharedAccessAuthorizationRuleResourceImpl(name, this.manager()); } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceListResult.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/NamespaceListResult.java similarity index 66% rename from sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceListResult.java rename to sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/NamespaceListResult.java index 9f008d707dda..f38fca8b14ee 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceListResult.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/NamespaceListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.notificationhubs.models; +package com.azure.resourcemanager.notificationhubs.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,28 +14,28 @@ import java.util.List; /** - * The response of the List Namespace operation. + * Paged collection of NamespaceResource items. */ -@Fluent +@Immutable public final class NamespaceListResult implements JsonSerializable { /* - * Result of the List Namespace operation. + * The NamespaceResource items on this page */ private List value; /* - * Link to the next set of results. Not empty if Value contains incomplete list of Namespaces + * The link to the next page of items */ private String nextLink; /** * Creates an instance of NamespaceListResult class. */ - public NamespaceListResult() { + private NamespaceListResult() { } /** - * Get the value property: Result of the List Namespace operation. + * Get the value property: The NamespaceResource items on this page. * * @return the value value. */ @@ -44,19 +44,7 @@ public List value() { } /** - * Set the value property: Result of the List Namespace operation. - * - * @param value the value value to set. - * @return the NamespaceListResult object itself. - */ - public NamespaceListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: Link to the next set of results. Not empty if Value contains incomplete list of - * Namespaces. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -64,18 +52,6 @@ public String nextLink() { return this.nextLink; } - /** - * Set the nextLink property: Link to the next set of results. Not empty if Value contains incomplete list of - * Namespaces. - * - * @param nextLink the nextLink value to set. - * @return the NamespaceListResult object itself. - */ - public NamespaceListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * @@ -93,7 +69,6 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("nextLink", this.nextLink); return jsonWriter.writeEndObject(); } @@ -104,6 +79,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of NamespaceListResult if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the NamespaceListResult. */ public static NamespaceListResult fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubListResult.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/NotificationHubListResult.java similarity index 66% rename from sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubListResult.java rename to sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/NotificationHubListResult.java index 94f96b18e4a4..a6acf3a022d2 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubListResult.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/NotificationHubListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.notificationhubs.models; +package com.azure.resourcemanager.notificationhubs.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,28 +14,28 @@ import java.util.List; /** - * The response of the List NotificationHub operation. + * Paged collection of NotificationHubResource items. */ -@Fluent +@Immutable public final class NotificationHubListResult implements JsonSerializable { /* - * Result of the List NotificationHub operation. + * The NotificationHubResource items on this page */ private List value; /* - * Link to the next set of results. Not empty if Value contains incomplete list of NotificationHub + * The link to the next page of items */ private String nextLink; /** * Creates an instance of NotificationHubListResult class. */ - public NotificationHubListResult() { + private NotificationHubListResult() { } /** - * Get the value property: Result of the List NotificationHub operation. + * Get the value property: The NotificationHubResource items on this page. * * @return the value value. */ @@ -44,19 +44,7 @@ public List value() { } /** - * Set the value property: Result of the List NotificationHub operation. - * - * @param value the value value to set. - * @return the NotificationHubListResult object itself. - */ - public NotificationHubListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: Link to the next set of results. Not empty if Value contains incomplete list of - * NotificationHub. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -64,18 +52,6 @@ public String nextLink() { return this.nextLink; } - /** - * Set the nextLink property: Link to the next set of results. Not empty if Value contains incomplete list of - * NotificationHub. - * - * @param nextLink the nextLink value to set. - * @return the NotificationHubListResult object itself. - */ - public NotificationHubListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * @@ -93,7 +69,6 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("nextLink", this.nextLink); return jsonWriter.writeEndObject(); } @@ -104,6 +79,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of NotificationHubListResult if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the NotificationHubListResult. */ public static NotificationHubListResult fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationListResult.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/OperationListResult.java similarity index 79% rename from sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationListResult.java rename to sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/OperationListResult.java index 70004b1ea834..a956771553e6 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationListResult.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/OperationListResult.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.notificationhubs.models; +package com.azure.resourcemanager.notificationhubs.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -14,30 +14,28 @@ import java.util.List; /** - * Result of the request to list NotificationHubs operations. It contains a list of operations and a URL link to get the - * next set of results. + * Paged collection of Operation items. */ @Immutable public final class OperationListResult implements JsonSerializable { /* - * List of NotificationHubs operations supported by the Microsoft.NotificationHubs resource provider. + * The Operation items on this page */ private List value; /* - * URL to get the next set of operation list results if there are any. + * The link to the next page of items */ private String nextLink; /** * Creates an instance of OperationListResult class. */ - public OperationListResult() { + private OperationListResult() { } /** - * Get the value property: List of NotificationHubs operations supported by the Microsoft.NotificationHubs resource - * provider. + * Get the value property: The Operation items on this page. * * @return the value value. */ @@ -46,7 +44,7 @@ public List value() { } /** - * Get the nextLink property: URL to get the next set of operation list results if there are any. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -71,6 +69,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); return jsonWriter.writeEndObject(); } @@ -80,6 +79,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the OperationListResult. */ public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/PrivateEndpointConnectionResourceListResult.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/PrivateEndpointConnectionResourceListResult.java new file mode 100644 index 000000000000..a5981ef3d17f --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/PrivateEndpointConnectionResourceListResult.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateEndpointConnectionResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PrivateEndpointConnectionResource list operation. + */ +@Immutable +public final class PrivateEndpointConnectionResourceListResult + implements JsonSerializable { + /* + * The PrivateEndpointConnectionResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PrivateEndpointConnectionResourceListResult class. + */ + private PrivateEndpointConnectionResourceListResult() { + } + + /** + * Get the value property: The PrivateEndpointConnectionResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionResourceListResult if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionResourceListResult. + */ + public static PrivateEndpointConnectionResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionResourceListResult deserializedPrivateEndpointConnectionResourceListResult + = new PrivateEndpointConnectionResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateEndpointConnectionResourceInner.fromJson(reader1)); + deserializedPrivateEndpointConnectionResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionResourceListResult; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/PrivateLinkResourceListResult.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/PrivateLinkResourceListResult.java new file mode 100644 index 000000000000..5bace78b9fd8 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/PrivateLinkResourceListResult.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateLinkResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PrivateLinkResource list operation. + */ +@Immutable +public final class PrivateLinkResourceListResult implements JsonSerializable { + /* + * The PrivateLinkResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PrivateLinkResourceListResult class. + */ + private PrivateLinkResourceListResult() { + } + + /** + * Get the value property: The PrivateLinkResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateLinkResourceListResult. + */ + public static PrivateLinkResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceListResult deserializedPrivateLinkResourceListResult + = new PrivateLinkResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateLinkResourceInner.fromJson(reader1)); + deserializedPrivateLinkResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateLinkResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceListResult; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleListResult.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/SharedAccessAuthorizationRuleListResult.java similarity index 66% rename from sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleListResult.java rename to sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/SharedAccessAuthorizationRuleListResult.java index 0e225443ba9f..00c912f4a629 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleListResult.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/models/SharedAccessAuthorizationRuleListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.notificationhubs.models; +package com.azure.resourcemanager.notificationhubs.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,29 +14,29 @@ import java.util.List; /** - * The response of the List Namespace operation. + * Paged collection of SharedAccessAuthorizationRuleResource items. */ -@Fluent +@Immutable public final class SharedAccessAuthorizationRuleListResult implements JsonSerializable { /* - * Result of the List AuthorizationRules operation. + * The SharedAccessAuthorizationRuleResource items on this page */ private List value; /* - * Link to the next set of results. Not empty if Value contains incomplete list of AuthorizationRules + * The link to the next page of items */ private String nextLink; /** * Creates an instance of SharedAccessAuthorizationRuleListResult class. */ - public SharedAccessAuthorizationRuleListResult() { + private SharedAccessAuthorizationRuleListResult() { } /** - * Get the value property: Result of the List AuthorizationRules operation. + * Get the value property: The SharedAccessAuthorizationRuleResource items on this page. * * @return the value value. */ @@ -45,19 +45,7 @@ public List value() { } /** - * Set the value property: Result of the List AuthorizationRules operation. - * - * @param value the value value to set. - * @return the SharedAccessAuthorizationRuleListResult object itself. - */ - public SharedAccessAuthorizationRuleListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: Link to the next set of results. Not empty if Value contains incomplete list of - * AuthorizationRules. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -65,18 +53,6 @@ public String nextLink() { return this.nextLink; } - /** - * Set the nextLink property: Link to the next set of results. Not empty if Value contains incomplete list of - * AuthorizationRules. - * - * @param nextLink the nextLink value to set. - * @return the SharedAccessAuthorizationRuleListResult object itself. - */ - public SharedAccessAuthorizationRuleListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * @@ -94,7 +70,6 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("nextLink", this.nextLink); return jsonWriter.writeEndObject(); } @@ -105,6 +80,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of SharedAccessAuthorizationRuleListResult if the JsonReader was pointing to an instance of * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the SharedAccessAuthorizationRuleListResult. */ public static SharedAccessAuthorizationRuleListResult fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/package-info.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/package-info.java index ea453fc30156..9f1a98f5906d 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/package-info.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/implementation/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the implementations for NotificationHubsManagementClient. - * Azure NotificationHub client. + * Package containing the implementations for Notificationhubs. + * Microsoft Notification Hubs Resource Provider REST API. */ package com.azure.resourcemanager.notificationhubs.implementation; diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/AccessRights.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/AccessRights.java index 0de2c6e40eef..37066cea2abe 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/AccessRights.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/AccessRights.java @@ -1,61 +1,56 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + /** * Defines values for AccessRights. */ -public enum AccessRights { +public final class AccessRights extends ExpandableStringEnum { /** - * Enum value Manage. + * Static value Manage for AccessRights. */ - MANAGE("Manage"), + public static final AccessRights MANAGE = fromString("Manage"); /** - * Enum value Send. + * Static value Send for AccessRights. */ - SEND("Send"), + public static final AccessRights SEND = fromString("Send"); /** - * Enum value Listen. + * Static value Listen for AccessRights. */ - LISTEN("Listen"); + public static final AccessRights LISTEN = fromString("Listen"); /** - * The actual serialized value for a AccessRights instance. + * Creates a new instance of AccessRights value. + * + * @deprecated Use the {@link #fromString(String)} factory method. */ - private final String value; - - AccessRights(String value) { - this.value = value; + @Deprecated + public AccessRights() { } /** - * Parses a serialized value to a AccessRights instance. + * Creates or finds a AccessRights from its string representation. * - * @param value the serialized value to parse. - * @return the parsed AccessRights object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding AccessRights. */ - public static AccessRights fromString(String value) { - if (value == null) { - return null; - } - AccessRights[] items = AccessRights.values(); - for (AccessRights item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static AccessRights fromString(String name) { + return fromString(name, AccessRights.class); } /** - * {@inheritDoc} + * Gets known AccessRights values. + * + * @return known AccessRights values. */ - @Override - public String toString() { - return this.value; + public static Collection values() { + return values(AccessRights.class); } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/AdmCredential.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/AdmCredential.java index c4a745bce903..07649300b0b1 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/AdmCredential.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/AdmCredential.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,9 +19,9 @@ @Fluent public final class AdmCredential implements JsonSerializable { /* - * Properties of NotificationHub AdmCredential. + * Description of a NotificationHub AdmCredential. */ - private AdmCredentialProperties innerProperties; + private AdmCredentialProperties innerProperties = new AdmCredentialProperties(); /** * Creates an instance of AdmCredential class. @@ -29,7 +30,7 @@ public AdmCredential() { } /** - * Get the innerProperties property: Properties of NotificationHub AdmCredential. + * Get the innerProperties property: Description of a NotificationHub AdmCredential. * * @return the innerProperties value. */ @@ -38,7 +39,7 @@ private AdmCredentialProperties innerProperties() { } /** - * Get the clientId property: The client identifier. + * Get the clientId property: Gets or sets the client identifier. * * @return the clientId value. */ @@ -47,7 +48,7 @@ public String clientId() { } /** - * Set the clientId property: The client identifier. + * Set the clientId property: Gets or sets the client identifier. * * @param clientId the clientId value to set. * @return the AdmCredential object itself. @@ -61,7 +62,7 @@ public AdmCredential withClientId(String clientId) { } /** - * Get the clientSecret property: The credential secret access key. + * Get the clientSecret property: Gets or sets the credential secret access key. * * @return the clientSecret value. */ @@ -70,7 +71,7 @@ public String clientSecret() { } /** - * Set the clientSecret property: The credential secret access key. + * Set the clientSecret property: Gets or sets the credential secret access key. * * @param clientSecret the clientSecret value to set. * @return the AdmCredential object itself. @@ -84,7 +85,7 @@ public AdmCredential withClientSecret(String clientSecret) { } /** - * Get the authTokenUrl property: The URL of the authorization token. + * Get the authTokenUrl property: Gets or sets the URL of the authorization token. * * @return the authTokenUrl value. */ @@ -93,7 +94,7 @@ public String authTokenUrl() { } /** - * Set the authTokenUrl property: The URL of the authorization token. + * Set the authTokenUrl property: Gets or sets the URL of the authorization token. * * @param authTokenUrl the authTokenUrl value to set. * @return the AdmCredential object itself. @@ -112,11 +113,16 @@ public AdmCredential withAuthTokenUrl(String authTokenUrl) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (innerProperties() != null) { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model AdmCredential")); + } else { innerProperties().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(AdmCredential.class); + /** * {@inheritDoc} */ @@ -133,6 +139,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of AdmCredential if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the AdmCredential. */ public static AdmCredential fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ApnsCredential.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ApnsCredential.java index 0fad4fd6c840..37383b808ffd 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ApnsCredential.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ApnsCredential.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,9 +19,9 @@ @Fluent public final class ApnsCredential implements JsonSerializable { /* - * Properties of NotificationHub ApnsCredential. + * Description of a NotificationHub ApnsCredential. */ - private ApnsCredentialProperties innerProperties; + private ApnsCredentialProperties innerProperties = new ApnsCredentialProperties(); /** * Creates an instance of ApnsCredential class. @@ -29,7 +30,7 @@ public ApnsCredential() { } /** - * Get the innerProperties property: Properties of NotificationHub ApnsCredential. + * Get the innerProperties property: Description of a NotificationHub ApnsCredential. * * @return the innerProperties value. */ @@ -38,7 +39,7 @@ private ApnsCredentialProperties innerProperties() { } /** - * Get the apnsCertificate property: The APNS certificate. Specify if using Certificate Authentication Mode. + * Get the apnsCertificate property: Gets or sets the APNS certificate. * * @return the apnsCertificate value. */ @@ -47,7 +48,7 @@ public String apnsCertificate() { } /** - * Set the apnsCertificate property: The APNS certificate. Specify if using Certificate Authentication Mode. + * Set the apnsCertificate property: Gets or sets the APNS certificate. * * @param apnsCertificate the apnsCertificate value to set. * @return the ApnsCredential object itself. @@ -61,7 +62,7 @@ public ApnsCredential withApnsCertificate(String apnsCertificate) { } /** - * Get the certificateKey property: The APNS certificate password if it exists. + * Get the certificateKey property: Gets or sets the certificate key. * * @return the certificateKey value. */ @@ -70,7 +71,7 @@ public String certificateKey() { } /** - * Set the certificateKey property: The APNS certificate password if it exists. + * Set the certificateKey property: Gets or sets the certificate key. * * @param certificateKey the certificateKey value to set. * @return the ApnsCredential object itself. @@ -84,11 +85,7 @@ public ApnsCredential withCertificateKey(String certificateKey) { } /** - * Get the endpoint property: 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'. + * Get the endpoint property: Gets or sets the endpoint of this credential. * * @return the endpoint value. */ @@ -97,11 +94,7 @@ public String endpoint() { } /** - * Set the endpoint property: 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'. + * Set the endpoint property: Gets or sets the endpoint of this credential. * * @param endpoint the endpoint value to set. * @return the ApnsCredential object itself. @@ -115,7 +108,7 @@ public ApnsCredential withEndpoint(String endpoint) { } /** - * Get the thumbprint property: The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. + * Get the thumbprint property: Gets or sets the APNS certificate Thumbprint. * * @return the thumbprint value. */ @@ -124,7 +117,7 @@ public String thumbprint() { } /** - * Set the thumbprint property: The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. + * Set the thumbprint property: Gets or sets the APNS certificate Thumbprint. * * @param thumbprint the thumbprint value to set. * @return the ApnsCredential object itself. @@ -138,8 +131,8 @@ public ApnsCredential withThumbprint(String thumbprint) { } /** - * Get the keyId property: A 10-character key identifier (kid) key, obtained from your developer account. Specify if - * using Token Authentication Mode. + * Get the keyId property: Gets or sets a 10-character key identifier (kid) key, obtained from + * your developer account. * * @return the keyId value. */ @@ -148,8 +141,8 @@ public String keyId() { } /** - * Set the keyId property: A 10-character key identifier (kid) key, obtained from your developer account. Specify if - * using Token Authentication Mode. + * Set the keyId property: Gets or sets a 10-character key identifier (kid) key, obtained from + * your developer account. * * @param keyId the keyId value to set. * @return the ApnsCredential object itself. @@ -163,7 +156,7 @@ public ApnsCredential withKeyId(String keyId) { } /** - * Get the appName property: The name of the application or BundleId. Specify if using Token Authentication Mode. + * Get the appName property: Gets or sets the name of the application. * * @return the appName value. */ @@ -172,7 +165,7 @@ public String appName() { } /** - * Set the appName property: The name of the application or BundleId. Specify if using Token Authentication Mode. + * Set the appName property: Gets or sets the name of the application. * * @param appName the appName value to set. * @return the ApnsCredential object itself. @@ -186,8 +179,8 @@ public ApnsCredential withAppName(String appName) { } /** - * Get the appId property: The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from - * your developer account. Specify if using Token Authentication Mode. + * Get the appId property: Gets or sets the issuer (iss) registered claim key, whose value is + * your 10-character Team ID, obtained from your developer account. * * @return the appId value. */ @@ -196,8 +189,8 @@ public String appId() { } /** - * Set the appId property: The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from - * your developer account. Specify if using Token Authentication Mode. + * Set the appId property: Gets or sets the issuer (iss) registered claim key, whose value is + * your 10-character Team ID, obtained from your developer account. * * @param appId the appId value to set. * @return the ApnsCredential object itself. @@ -211,8 +204,8 @@ public ApnsCredential withAppId(String appId) { } /** - * Get the token property: Provider Authentication Token, obtained through your developer account. Specify if using - * Token Authentication Mode. + * Get the token property: Gets or sets provider Authentication Token, obtained through your + * developer account. * * @return the token value. */ @@ -221,8 +214,8 @@ public String token() { } /** - * Set the token property: Provider Authentication Token, obtained through your developer account. Specify if using - * Token Authentication Mode. + * Set the token property: Gets or sets provider Authentication Token, obtained through your + * developer account. * * @param token the token value to set. * @return the ApnsCredential object itself. @@ -241,11 +234,16 @@ public ApnsCredential withToken(String token) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (innerProperties() != null) { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model ApnsCredential")); + } else { innerProperties().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(ApnsCredential.class); + /** * {@inheritDoc} */ @@ -262,6 +260,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of ApnsCredential if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the ApnsCredential. */ public static ApnsCredential fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Availability.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Availability.java new file mode 100644 index 000000000000..7fe2f5e70c74 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Availability.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents metric availability (part of RP operation descriptions). + */ +@Immutable +public final class Availability implements JsonSerializable { + /* + * Time grain of the availability. + */ + private String timeGrain; + + /* + * Duration of the availability blob. + */ + private String blobDuration; + + /** + * Creates an instance of Availability class. + */ + private Availability() { + } + + /** + * Get the timeGrain property: Time grain of the availability. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the blobDuration property: Duration of the availability blob. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Availability from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Availability if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Availability. + */ + public static Availability fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Availability deserializedAvailability = new Availability(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timeGrain".equals(fieldName)) { + deserializedAvailability.timeGrain = reader.getString(); + } else if ("blobDuration".equals(fieldName)) { + deserializedAvailability.blobDuration = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailability; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/BaiduCredential.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/BaiduCredential.java index 6f09113734ed..8d144106f9ba 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/BaiduCredential.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/BaiduCredential.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,9 +19,9 @@ @Fluent public final class BaiduCredential implements JsonSerializable { /* - * Properties of NotificationHub BaiduCredential. + * Description of a NotificationHub BaiduCredential. */ - private BaiduCredentialProperties innerProperties; + private BaiduCredentialProperties innerProperties = new BaiduCredentialProperties(); /** * Creates an instance of BaiduCredential class. @@ -29,7 +30,7 @@ public BaiduCredential() { } /** - * Get the innerProperties property: Properties of NotificationHub BaiduCredential. + * Get the innerProperties property: Description of a NotificationHub BaiduCredential. * * @return the innerProperties value. */ @@ -38,7 +39,7 @@ private BaiduCredentialProperties innerProperties() { } /** - * Get the baiduApiKey property: Baidu Api Key. + * Get the baiduApiKey property: Gets or sets baidu Api Key. * * @return the baiduApiKey value. */ @@ -47,7 +48,7 @@ public String baiduApiKey() { } /** - * Set the baiduApiKey property: Baidu Api Key. + * Set the baiduApiKey property: Gets or sets baidu Api Key. * * @param baiduApiKey the baiduApiKey value to set. * @return the BaiduCredential object itself. @@ -61,7 +62,7 @@ public BaiduCredential withBaiduApiKey(String baiduApiKey) { } /** - * Get the baiduEndPoint property: Baidu Endpoint. + * Get the baiduEndPoint property: Gets or sets baidu Endpoint. * * @return the baiduEndPoint value. */ @@ -70,7 +71,7 @@ public String baiduEndPoint() { } /** - * Set the baiduEndPoint property: Baidu Endpoint. + * Set the baiduEndPoint property: Gets or sets baidu Endpoint. * * @param baiduEndPoint the baiduEndPoint value to set. * @return the BaiduCredential object itself. @@ -84,7 +85,7 @@ public BaiduCredential withBaiduEndPoint(String baiduEndPoint) { } /** - * Get the baiduSecretKey property: Baidu Secret Key. + * Get the baiduSecretKey property: Gets or sets baidu Secret Key. * * @return the baiduSecretKey value. */ @@ -93,7 +94,7 @@ public String baiduSecretKey() { } /** - * Set the baiduSecretKey property: Baidu Secret Key. + * Set the baiduSecretKey property: Gets or sets baidu Secret Key. * * @param baiduSecretKey the baiduSecretKey value to set. * @return the BaiduCredential object itself. @@ -112,11 +113,17 @@ public BaiduCredential withBaiduSecretKey(String baiduSecretKey) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (innerProperties() != null) { + if (innerProperties() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property innerProperties in model BaiduCredential")); + } else { innerProperties().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(BaiduCredential.class); + /** * {@inheritDoc} */ @@ -133,6 +140,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of BaiduCredential if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the BaiduCredential. */ public static BaiduCredential fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/BrowserCredential.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/BrowserCredential.java new file mode 100644 index 000000000000..49a277c0f0ac --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/BrowserCredential.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.fluent.models.BrowserCredentialProperties; +import java.io.IOException; + +/** + * Description of a NotificationHub BrowserCredential. + */ +@Fluent +public final class BrowserCredential implements JsonSerializable { + /* + * Description of a NotificationHub BrowserCredential. + */ + private BrowserCredentialProperties innerProperties = new BrowserCredentialProperties(); + + /** + * Creates an instance of BrowserCredential class. + */ + public BrowserCredential() { + } + + /** + * Get the innerProperties property: Description of a NotificationHub BrowserCredential. + * + * @return the innerProperties value. + */ + private BrowserCredentialProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the subject property: Gets or sets web push subject. + * + * @return the subject value. + */ + public String subject() { + return this.innerProperties() == null ? null : this.innerProperties().subject(); + } + + /** + * Set the subject property: Gets or sets web push subject. + * + * @param subject the subject value to set. + * @return the BrowserCredential object itself. + */ + public BrowserCredential withSubject(String subject) { + if (this.innerProperties() == null) { + this.innerProperties = new BrowserCredentialProperties(); + } + this.innerProperties().withSubject(subject); + return this; + } + + /** + * Get the vapidPrivateKey property: Gets or sets VAPID private key. + * + * @return the vapidPrivateKey value. + */ + public String vapidPrivateKey() { + return this.innerProperties() == null ? null : this.innerProperties().vapidPrivateKey(); + } + + /** + * Set the vapidPrivateKey property: Gets or sets VAPID private key. + * + * @param vapidPrivateKey the vapidPrivateKey value to set. + * @return the BrowserCredential object itself. + */ + public BrowserCredential withVapidPrivateKey(String vapidPrivateKey) { + if (this.innerProperties() == null) { + this.innerProperties = new BrowserCredentialProperties(); + } + this.innerProperties().withVapidPrivateKey(vapidPrivateKey); + return this; + } + + /** + * Get the vapidPublicKey property: Gets or sets VAPID public key. + * + * @return the vapidPublicKey value. + */ + public String vapidPublicKey() { + return this.innerProperties() == null ? null : this.innerProperties().vapidPublicKey(); + } + + /** + * Set the vapidPublicKey property: Gets or sets VAPID public key. + * + * @param vapidPublicKey the vapidPublicKey value to set. + * @return the BrowserCredential object itself. + */ + public BrowserCredential withVapidPublicKey(String vapidPublicKey) { + if (this.innerProperties() == null) { + this.innerProperties = new BrowserCredentialProperties(); + } + this.innerProperties().withVapidPublicKey(vapidPublicKey); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model BrowserCredential")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BrowserCredential.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BrowserCredential from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BrowserCredential if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BrowserCredential. + */ + public static BrowserCredential fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BrowserCredential deserializedBrowserCredential = new BrowserCredential(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedBrowserCredential.innerProperties = BrowserCredentialProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBrowserCredential; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/CheckAvailabilityParameters.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/CheckAvailabilityParameters.java index 0d4035b2604c..11b197c735f6 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/CheckAvailabilityParameters.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/CheckAvailabilityParameters.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; @@ -14,44 +14,45 @@ import java.util.Map; /** - * Parameters supplied to the Check Name Availability for Namespace and NotificationHubs. + * Parameters supplied to the Check Name Availability for Namespace and + * NotificationHubs. */ @Fluent public final class CheckAvailabilityParameters implements JsonSerializable { /* - * Resource Id + * Gets resource Id */ private String id; /* - * Resource name + * Gets or sets resource name */ private String name; /* - * Resource type + * Gets resource type */ private String type; /* - * Resource location + * Gets or sets resource location */ private String location; /* - * Resource tags + * Gets or sets resource tags */ private Map tags; /* - * The sku of the created namespace + * Not used and deprecated since API version 2023-01-01-preview */ - private Sku sku; + private Boolean isAvailiable; /* - * True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. + * The Sku description for a namespace */ - private Boolean isAvailiable; + private Sku sku; /** * Creates an instance of CheckAvailabilityParameters class. @@ -60,7 +61,7 @@ public CheckAvailabilityParameters() { } /** - * Get the id property: Resource Id. + * Get the id property: Gets resource Id. * * @return the id value. */ @@ -69,7 +70,7 @@ public String id() { } /** - * Get the name property: Resource name. + * Get the name property: Gets or sets resource name. * * @return the name value. */ @@ -78,7 +79,7 @@ public String name() { } /** - * Set the name property: Resource name. + * Set the name property: Gets or sets resource name. * * @param name the name value to set. * @return the CheckAvailabilityParameters object itself. @@ -89,7 +90,7 @@ public CheckAvailabilityParameters withName(String name) { } /** - * Get the type property: Resource type. + * Get the type property: Gets resource type. * * @return the type value. */ @@ -98,7 +99,7 @@ public String type() { } /** - * Get the location property: Resource location. + * Get the location property: Gets or sets resource location. * * @return the location value. */ @@ -107,7 +108,7 @@ public String location() { } /** - * Set the location property: Resource location. + * Set the location property: Gets or sets resource location. * * @param location the location value to set. * @return the CheckAvailabilityParameters object itself. @@ -118,7 +119,7 @@ public CheckAvailabilityParameters withLocation(String location) { } /** - * Get the tags property: Resource tags. + * Get the tags property: Gets or sets resource tags. * * @return the tags value. */ @@ -127,7 +128,7 @@ public Map tags() { } /** - * Set the tags property: Resource tags. + * Set the tags property: Gets or sets resource tags. * * @param tags the tags value to set. * @return the CheckAvailabilityParameters object itself. @@ -138,44 +139,42 @@ public CheckAvailabilityParameters withTags(Map tags) { } /** - * Get the sku property: The sku of the created namespace. + * Get the isAvailiable property: Not used and deprecated since API version 2023-01-01-preview. * - * @return the sku value. + * @return the isAvailiable value. */ - public Sku sku() { - return this.sku; + public Boolean isAvailiable() { + return this.isAvailiable; } /** - * Set the sku property: The sku of the created namespace. + * Set the isAvailiable property: Not used and deprecated since API version 2023-01-01-preview. * - * @param sku the sku value to set. + * @param isAvailiable the isAvailiable value to set. * @return the CheckAvailabilityParameters object itself. */ - public CheckAvailabilityParameters withSku(Sku sku) { - this.sku = sku; + public CheckAvailabilityParameters withIsAvailiable(Boolean isAvailiable) { + this.isAvailiable = isAvailiable; return this; } /** - * Get the isAvailiable property: True if the name is available and can be used to create new - * Namespace/NotificationHub. Otherwise false. + * Get the sku property: The Sku description for a namespace. * - * @return the isAvailiable value. + * @return the sku value. */ - public Boolean isAvailiable() { - return this.isAvailiable; + public Sku sku() { + return this.sku; } /** - * Set the isAvailiable property: True if the name is available and can be used to create new - * Namespace/NotificationHub. Otherwise false. + * Set the sku property: The Sku description for a namespace. * - * @param isAvailiable the isAvailiable value to set. + * @param sku the sku value to set. * @return the CheckAvailabilityParameters object itself. */ - public CheckAvailabilityParameters withIsAvailiable(Boolean isAvailiable) { - this.isAvailiable = isAvailiable; + public CheckAvailabilityParameters withSku(Sku sku) { + this.sku = sku; return this; } @@ -206,8 +205,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("name", this.name); jsonWriter.writeStringField("location", this.location); jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("sku", this.sku); jsonWriter.writeBooleanField("isAvailiable", this.isAvailiable); + jsonWriter.writeJsonField("sku", this.sku); return jsonWriter.writeEndObject(); } @@ -238,10 +237,10 @@ public static CheckAvailabilityParameters fromJson(JsonReader jsonReader) throws } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); deserializedCheckAvailabilityParameters.tags = tags; - } else if ("sku".equals(fieldName)) { - deserializedCheckAvailabilityParameters.sku = Sku.fromJson(reader); } else if ("isAvailiable".equals(fieldName)) { deserializedCheckAvailabilityParameters.isAvailiable = reader.getNullable(JsonReader::getBoolean); + } else if ("sku".equals(fieldName)) { + deserializedCheckAvailabilityParameters.sku = Sku.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/CheckAvailabilityResult.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/CheckAvailabilityResult.java index 35ae18e54b7f..ac447a19482c 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/CheckAvailabilityResult.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/CheckAvailabilityResult.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; import java.util.Map; @@ -33,33 +34,40 @@ public interface CheckAvailabilityResult { String type(); /** - * Gets the location property: The geo-location where the resource lives. + * Gets the isAvailiable property: Gets or sets true if the name is available and can be used to + * create new Namespace/NotificationHub. Otherwise false. + * + * @return the isAvailiable value. + */ + Boolean isAvailiable(); + + /** + * Gets the location property: Deprecated - only for compatibility. * * @return the location value. */ String location(); /** - * Gets the tags property: Resource tags. + * Gets the tags property: Deprecated - only for compatibility. * * @return the tags value. */ Map tags(); /** - * Gets the isAvailiable property: True if the name is available and can be used to create new - * Namespace/NotificationHub. Otherwise false. + * Gets the sku property: The Sku description for a namespace. * - * @return the isAvailiable value. + * @return the sku value. */ - Boolean isAvailiable(); + Sku sku(); /** - * Gets the sku property: The sku of the created namespace. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the sku value. + * @return the systemData value. */ - Sku sku(); + SystemData systemData(); /** * Gets the inner com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner object. diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/DebugSendResponse.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/DebugSendResponse.java index 7a70d1426791..f878168c9c9b 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/DebugSendResponse.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/DebugSendResponse.java @@ -1,10 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner; +import java.util.List; import java.util.Map; /** @@ -33,46 +35,46 @@ public interface DebugSendResponse { String type(); /** - * Gets the location property: The geo-location where the resource lives. + * Gets the location property: Deprecated - only for compatibility. * * @return the location value. */ String location(); /** - * Gets the tags property: Resource tags. + * Gets the tags property: Deprecated - only for compatibility. * * @return the tags value. */ Map tags(); /** - * Gets the sku property: The sku of the created namespace. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the sku value. + * @return the systemData value. */ - Sku sku(); + SystemData systemData(); /** - * Gets the success property: successful send. + * Gets the success property: Gets or sets successful send. * * @return the success value. */ - Float success(); + Long success(); /** - * Gets the failure property: send failure. + * Gets the failure property: Gets or sets send failure. * * @return the failure value. */ - Float failure(); + Long failure(); /** - * Gets the results property: actual failure description. + * Gets the results property: Gets or sets actual failure description. * * @return the results value. */ - Object results(); + List results(); /** * Gets the inner com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner object. diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/FcmV1Credential.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/FcmV1Credential.java new file mode 100644 index 000000000000..91372de935fb --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/FcmV1Credential.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.fluent.models.FcmV1CredentialProperties; +import java.io.IOException; + +/** + * Description of a NotificationHub FcmV1Credential. + */ +@Fluent +public final class FcmV1Credential implements JsonSerializable { + /* + * Description of a NotificationHub FcmV1Credential. + */ + private FcmV1CredentialProperties innerProperties = new FcmV1CredentialProperties(); + + /** + * Creates an instance of FcmV1Credential class. + */ + public FcmV1Credential() { + } + + /** + * Get the innerProperties property: Description of a NotificationHub FcmV1Credential. + * + * @return the innerProperties value. + */ + private FcmV1CredentialProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the clientEmail property: Gets or sets client email. + * + * @return the clientEmail value. + */ + public String clientEmail() { + return this.innerProperties() == null ? null : this.innerProperties().clientEmail(); + } + + /** + * Set the clientEmail property: Gets or sets client email. + * + * @param clientEmail the clientEmail value to set. + * @return the FcmV1Credential object itself. + */ + public FcmV1Credential withClientEmail(String clientEmail) { + if (this.innerProperties() == null) { + this.innerProperties = new FcmV1CredentialProperties(); + } + this.innerProperties().withClientEmail(clientEmail); + return this; + } + + /** + * Get the privateKey property: Gets or sets private key. + * + * @return the privateKey value. + */ + public String privateKey() { + return this.innerProperties() == null ? null : this.innerProperties().privateKey(); + } + + /** + * Set the privateKey property: Gets or sets private key. + * + * @param privateKey the privateKey value to set. + * @return the FcmV1Credential object itself. + */ + public FcmV1Credential withPrivateKey(String privateKey) { + if (this.innerProperties() == null) { + this.innerProperties = new FcmV1CredentialProperties(); + } + this.innerProperties().withPrivateKey(privateKey); + return this; + } + + /** + * Get the projectId property: Gets or sets project id. + * + * @return the projectId value. + */ + public String projectId() { + return this.innerProperties() == null ? null : this.innerProperties().projectId(); + } + + /** + * Set the projectId property: Gets or sets project id. + * + * @param projectId the projectId value to set. + * @return the FcmV1Credential object itself. + */ + public FcmV1Credential withProjectId(String projectId) { + if (this.innerProperties() == null) { + this.innerProperties = new FcmV1CredentialProperties(); + } + this.innerProperties().withProjectId(projectId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property innerProperties in model FcmV1Credential")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FcmV1Credential.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FcmV1Credential from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FcmV1Credential if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FcmV1Credential. + */ + public static FcmV1Credential fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FcmV1Credential deserializedFcmV1Credential = new FcmV1Credential(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedFcmV1Credential.innerProperties = FcmV1CredentialProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFcmV1Credential; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/GcmCredential.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/GcmCredential.java index 17c3ee8dbd5f..9a6af36cc733 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/GcmCredential.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/GcmCredential.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,9 +19,9 @@ @Fluent public final class GcmCredential implements JsonSerializable { /* - * Properties of NotificationHub GcmCredential. + * Description of a NotificationHub GcmCredential. */ - private GcmCredentialProperties innerProperties; + private GcmCredentialProperties innerProperties = new GcmCredentialProperties(); /** * Creates an instance of GcmCredential class. @@ -29,7 +30,7 @@ public GcmCredential() { } /** - * Get the innerProperties property: Properties of NotificationHub GcmCredential. + * Get the innerProperties property: Description of a NotificationHub GcmCredential. * * @return the innerProperties value. */ @@ -38,7 +39,7 @@ private GcmCredentialProperties innerProperties() { } /** - * Get the gcmEndpoint property: The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send'. + * Get the gcmEndpoint property: Gets or sets the GCM endpoint. * * @return the gcmEndpoint value. */ @@ -47,7 +48,7 @@ public String gcmEndpoint() { } /** - * Set the gcmEndpoint property: The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send'. + * Set the gcmEndpoint property: Gets or sets the GCM endpoint. * * @param gcmEndpoint the gcmEndpoint value to set. * @return the GcmCredential object itself. @@ -61,7 +62,7 @@ public GcmCredential withGcmEndpoint(String gcmEndpoint) { } /** - * Get the googleApiKey property: The Google API key. + * Get the googleApiKey property: Gets or sets the Google API key. * * @return the googleApiKey value. */ @@ -70,7 +71,7 @@ public String googleApiKey() { } /** - * Set the googleApiKey property: The Google API key. + * Set the googleApiKey property: Gets or sets the Google API key. * * @param googleApiKey the googleApiKey value to set. * @return the GcmCredential object itself. @@ -89,11 +90,16 @@ public GcmCredential withGoogleApiKey(String googleApiKey) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (innerProperties() != null) { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model GcmCredential")); + } else { innerProperties().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(GcmCredential.class); + /** * {@inheritDoc} */ @@ -110,6 +116,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of GcmCredential if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the GcmCredential. */ public static GcmCredential fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/IpRule.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/IpRule.java new file mode 100644 index 000000000000..9f9a7e9428c7 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/IpRule.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A network authorization rule that filters traffic based on IP address. + */ +@Fluent +public final class IpRule implements JsonSerializable { + /* + * IP mask. + */ + private String ipMask; + + /* + * List of access rights. + */ + private List rights; + + /** + * Creates an instance of IpRule class. + */ + public IpRule() { + } + + /** + * Get the ipMask property: IP mask. + * + * @return the ipMask value. + */ + public String ipMask() { + return this.ipMask; + } + + /** + * Set the ipMask property: IP mask. + * + * @param ipMask the ipMask value to set. + * @return the IpRule object itself. + */ + public IpRule withIpMask(String ipMask) { + this.ipMask = ipMask; + return this; + } + + /** + * Get the rights property: List of access rights. + * + * @return the rights value. + */ + public List rights() { + return this.rights; + } + + /** + * Set the rights property: List of access rights. + * + * @param rights the rights value to set. + * @return the IpRule object itself. + */ + public IpRule withRights(List rights) { + this.rights = rights; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipMask() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property ipMask in model IpRule")); + } + if (rights() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property rights in model IpRule")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(IpRule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ipMask", this.ipMask); + jsonWriter.writeArrayField("rights", this.rights, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IpRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IpRule if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IpRule. + */ + public static IpRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IpRule deserializedIpRule = new IpRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipMask".equals(fieldName)) { + deserializedIpRule.ipMask = reader.getString(); + } else if ("rights".equals(fieldName)) { + List rights + = reader.readArray(reader1 -> AccessRights.fromString(reader1.getString())); + deserializedIpRule.rights = rights; + } else { + reader.skipChildren(); + } + } + + return deserializedIpRule; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/LogSpecification.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/LogSpecification.java new file mode 100644 index 000000000000..b391cf7d06ee --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/LogSpecification.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A single log category specification. + */ +@Immutable +public final class LogSpecification implements JsonSerializable { + /* + * Name of the log category. + */ + private String name; + + /* + * Display name of the log category. + */ + private String displayName; + + /* + * Duration of data written to a single blob. + */ + private String blobDuration; + + /* + * Category group for the log specification. + */ + private List categoryGroups; + + /** + * Creates an instance of LogSpecification class. + */ + private LogSpecification() { + } + + /** + * Get the name property: Name of the log category. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the displayName property: Display name of the log category. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the blobDuration property: Duration of data written to a single blob. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Get the categoryGroups property: Category group for the log specification. + * + * @return the categoryGroups value. + */ + public List categoryGroups() { + return this.categoryGroups; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("categoryGroups", this.categoryGroups, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogSpecification from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogSpecification if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LogSpecification. + */ + public static LogSpecification fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogSpecification deserializedLogSpecification = new LogSpecification(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLogSpecification.name = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedLogSpecification.displayName = reader.getString(); + } else if ("blobDuration".equals(fieldName)) { + deserializedLogSpecification.blobDuration = reader.getString(); + } else if ("categoryGroups".equals(fieldName)) { + List categoryGroups = reader.readArray(reader1 -> reader1.getString()); + deserializedLogSpecification.categoryGroups = categoryGroups; + } else { + reader.skipChildren(); + } + } + + return deserializedLogSpecification; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/MetricSpecification.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/MetricSpecification.java new file mode 100644 index 000000000000..64ca0d09a367 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/MetricSpecification.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A metric specification. + */ +@Immutable +public final class MetricSpecification implements JsonSerializable { + /* + * Metric name / id. + */ + private String name; + + /* + * User-visible metric name. + */ + private String displayName; + + /* + * Description of the metric. + */ + private String displayDescription; + + /* + * Metric unit. + */ + private String unit; + + /* + * Type of the aggregation (Average, Minimum, Maximum, Total or Count). + */ + private String aggregationType; + + /* + * List of availabilities. + */ + private List availabilities; + + /* + * List of supported time grain types. + */ + private List supportedTimeGrainTypes; + + /* + * The matching regex pattern to be applied to the field pointed by the "metricsFilterPathSelector" flag in the ARM + * manifest. + */ + private String metricFilterPattern; + + /* + * Optional property. If set to true, then zero will be returned for time duration where no metric is emitted / + * published. + */ + private Boolean fillGapWithZero; + + /** + * Creates an instance of MetricSpecification class. + */ + private MetricSpecification() { + } + + /** + * Get the name property: Metric name / id. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the displayName property: User-visible metric name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the displayDescription property: Description of the metric. + * + * @return the displayDescription value. + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Get the unit property: Metric unit. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the aggregationType property: Type of the aggregation (Average, Minimum, Maximum, Total or Count). + * + * @return the aggregationType value. + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Get the availabilities property: List of availabilities. + * + * @return the availabilities value. + */ + public List availabilities() { + return this.availabilities; + } + + /** + * Get the supportedTimeGrainTypes property: List of supported time grain types. + * + * @return the supportedTimeGrainTypes value. + */ + public List supportedTimeGrainTypes() { + return this.supportedTimeGrainTypes; + } + + /** + * Get the metricFilterPattern property: The matching regex pattern to be applied to the field pointed by the + * "metricsFilterPathSelector" flag in the ARM manifest. + * + * @return the metricFilterPattern value. + */ + public String metricFilterPattern() { + return this.metricFilterPattern; + } + + /** + * Get the fillGapWithZero property: Optional property. If set to true, then zero will be returned for time duration + * where no metric is emitted / published. + * + * @return the fillGapWithZero value. + */ + public Boolean fillGapWithZero() { + return this.fillGapWithZero; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (availabilities() != null) { + availabilities().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricSpecification from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricSpecification if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricSpecification. + */ + public static MetricSpecification fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricSpecification deserializedMetricSpecification = new MetricSpecification(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedMetricSpecification.name = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedMetricSpecification.displayName = reader.getString(); + } else if ("displayDescription".equals(fieldName)) { + deserializedMetricSpecification.displayDescription = reader.getString(); + } else if ("unit".equals(fieldName)) { + deserializedMetricSpecification.unit = reader.getString(); + } else if ("aggregationType".equals(fieldName)) { + deserializedMetricSpecification.aggregationType = reader.getString(); + } else if ("availabilities".equals(fieldName)) { + List availabilities = reader.readArray(reader1 -> Availability.fromJson(reader1)); + deserializedMetricSpecification.availabilities = availabilities; + } else if ("supportedTimeGrainTypes".equals(fieldName)) { + List supportedTimeGrainTypes = reader.readArray(reader1 -> reader1.getString()); + deserializedMetricSpecification.supportedTimeGrainTypes = supportedTimeGrainTypes; + } else if ("metricFilterPattern".equals(fieldName)) { + deserializedMetricSpecification.metricFilterPattern = reader.getString(); + } else if ("fillGapWithZero".equals(fieldName)) { + deserializedMetricSpecification.fillGapWithZero = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricSpecification; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/MpnsCredential.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/MpnsCredential.java index 588b1d6e80af..50604ebe9534 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/MpnsCredential.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/MpnsCredential.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,9 +19,9 @@ @Fluent public final class MpnsCredential implements JsonSerializable { /* - * Properties of NotificationHub MpnsCredential. + * Description of a NotificationHub MpnsCredential. */ - private MpnsCredentialProperties innerProperties; + private MpnsCredentialProperties innerProperties = new MpnsCredentialProperties(); /** * Creates an instance of MpnsCredential class. @@ -29,7 +30,7 @@ public MpnsCredential() { } /** - * Get the innerProperties property: Properties of NotificationHub MpnsCredential. + * Get the innerProperties property: Description of a NotificationHub MpnsCredential. * * @return the innerProperties value. */ @@ -38,7 +39,7 @@ private MpnsCredentialProperties innerProperties() { } /** - * Get the mpnsCertificate property: The MPNS certificate. + * Get the mpnsCertificate property: Gets or sets the MPNS certificate. * * @return the mpnsCertificate value. */ @@ -47,7 +48,7 @@ public String mpnsCertificate() { } /** - * Set the mpnsCertificate property: The MPNS certificate. + * Set the mpnsCertificate property: Gets or sets the MPNS certificate. * * @param mpnsCertificate the mpnsCertificate value to set. * @return the MpnsCredential object itself. @@ -61,7 +62,7 @@ public MpnsCredential withMpnsCertificate(String mpnsCertificate) { } /** - * Get the certificateKey property: The certificate key for this credential. + * Get the certificateKey property: Gets or sets the certificate key for this credential. * * @return the certificateKey value. */ @@ -70,7 +71,7 @@ public String certificateKey() { } /** - * Set the certificateKey property: The certificate key for this credential. + * Set the certificateKey property: Gets or sets the certificate key for this credential. * * @param certificateKey the certificateKey value to set. * @return the MpnsCredential object itself. @@ -84,7 +85,7 @@ public MpnsCredential withCertificateKey(String certificateKey) { } /** - * Get the thumbprint property: The MPNS certificate Thumbprint. + * Get the thumbprint property: Gets or sets the MPNS certificate Thumbprint. * * @return the thumbprint value. */ @@ -93,7 +94,7 @@ public String thumbprint() { } /** - * Set the thumbprint property: The MPNS certificate Thumbprint. + * Set the thumbprint property: Gets or sets the MPNS certificate Thumbprint. * * @param thumbprint the thumbprint value to set. * @return the MpnsCredential object itself. @@ -112,11 +113,16 @@ public MpnsCredential withThumbprint(String thumbprint) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (innerProperties() != null) { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model MpnsCredential")); + } else { innerProperties().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(MpnsCredential.class); + /** * {@inheritDoc} */ @@ -133,6 +139,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of MpnsCredential if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the MpnsCredential. */ public static MpnsCredential fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceCreateOrUpdateParameters.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceCreateOrUpdateParameters.java deleted file mode 100644 index 3fc629fbc2e4..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceCreateOrUpdateParameters.java +++ /dev/null @@ -1,512 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceProperties; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Parameters supplied to the CreateOrUpdate Namespace operation. - */ -@Fluent -public final class NamespaceCreateOrUpdateParameters extends Resource { - /* - * Properties of the Namespace. - */ - private NamespaceProperties innerProperties; - - /* - * The sku of the created namespace - */ - private Sku sku; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of NamespaceCreateOrUpdateParameters class. - */ - public NamespaceCreateOrUpdateParameters() { - } - - /** - * Get the innerProperties property: Properties of the Namespace. - * - * @return the innerProperties value. - */ - private NamespaceProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the sku property: The sku of the created namespace. - * - * @return the sku value. - */ - public Sku sku() { - return this.sku; - } - - /** - * Set the sku property: The sku of the created namespace. - * - * @param sku the sku value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withSku(Sku sku) { - this.sku = sku; - return this; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public NamespaceCreateOrUpdateParameters withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public NamespaceCreateOrUpdateParameters withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the name property: The name of the namespace. - * - * @return the name value. - */ - public String namePropertiesName() { - return this.innerProperties() == null ? null : this.innerProperties().name(); - } - - /** - * Set the name property: The name of the namespace. - * - * @param name the name value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withNamePropertiesName(String name) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withName(name); - return this; - } - - /** - * Get the provisioningState property: Provisioning state of the Namespace. - * - * @return the provisioningState value. - */ - public String provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); - } - - /** - * Set the provisioningState property: Provisioning state of the Namespace. - * - * @param provisioningState the provisioningState value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withProvisioningState(String provisioningState) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withProvisioningState(provisioningState); - return this; - } - - /** - * Get the region property: 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. - * - * @return the region value. - */ - public String region() { - return this.innerProperties() == null ? null : this.innerProperties().region(); - } - - /** - * Set the region property: 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. - * - * @param region the region value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withRegion(String region) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withRegion(region); - return this; - } - - /** - * Get the metricId property: Identifier for Azure Insights metrics. - * - * @return the metricId value. - */ - public String metricId() { - return this.innerProperties() == null ? null : this.innerProperties().metricId(); - } - - /** - * Get the status property: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = - * Suspended4 = Deleting. - * - * @return the status value. - */ - public String status() { - return this.innerProperties() == null ? null : this.innerProperties().status(); - } - - /** - * Set the status property: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = - * Suspended4 = Deleting. - * - * @param status the status value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withStatus(String status) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withStatus(status); - return this; - } - - /** - * Get the createdAt property: The time the namespace was created. - * - * @return the createdAt value. - */ - public OffsetDateTime createdAt() { - return this.innerProperties() == null ? null : this.innerProperties().createdAt(); - } - - /** - * Set the createdAt property: The time the namespace was created. - * - * @param createdAt the createdAt value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withCreatedAt(OffsetDateTime createdAt) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withCreatedAt(createdAt); - return this; - } - - /** - * Get the updatedAt property: The time the namespace was updated. - * - * @return the updatedAt value. - */ - public OffsetDateTime updatedAt() { - return this.innerProperties() == null ? null : this.innerProperties().updatedAt(); - } - - /** - * Set the updatedAt property: The time the namespace was updated. - * - * @param updatedAt the updatedAt value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withUpdatedAt(OffsetDateTime updatedAt) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withUpdatedAt(updatedAt); - return this; - } - - /** - * Get the serviceBusEndpoint property: Endpoint you can use to perform NotificationHub operations. - * - * @return the serviceBusEndpoint value. - */ - public String serviceBusEndpoint() { - return this.innerProperties() == null ? null : this.innerProperties().serviceBusEndpoint(); - } - - /** - * Set the serviceBusEndpoint property: Endpoint you can use to perform NotificationHub operations. - * - * @param serviceBusEndpoint the serviceBusEndpoint value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withServiceBusEndpoint(String serviceBusEndpoint) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withServiceBusEndpoint(serviceBusEndpoint); - return this; - } - - /** - * Get the subscriptionId property: The Id of the Azure subscription associated with the namespace. - * - * @return the subscriptionId value. - */ - public String subscriptionId() { - return this.innerProperties() == null ? null : this.innerProperties().subscriptionId(); - } - - /** - * Set the subscriptionId property: The Id of the Azure subscription associated with the namespace. - * - * @param subscriptionId the subscriptionId value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withSubscriptionId(String subscriptionId) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withSubscriptionId(subscriptionId); - return this; - } - - /** - * Get the scaleUnit property: ScaleUnit where the namespace gets created. - * - * @return the scaleUnit value. - */ - public String scaleUnit() { - return this.innerProperties() == null ? null : this.innerProperties().scaleUnit(); - } - - /** - * Set the scaleUnit property: ScaleUnit where the namespace gets created. - * - * @param scaleUnit the scaleUnit value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withScaleUnit(String scaleUnit) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withScaleUnit(scaleUnit); - return this; - } - - /** - * Get the enabled property: Whether or not the namespace is currently enabled. - * - * @return the enabled value. - */ - public Boolean enabled() { - return this.innerProperties() == null ? null : this.innerProperties().enabled(); - } - - /** - * Set the enabled property: Whether or not the namespace is currently enabled. - * - * @param enabled the enabled value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withEnabled(Boolean enabled) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withEnabled(enabled); - return this; - } - - /** - * Get the critical property: Whether or not the namespace is set as Critical. - * - * @return the critical value. - */ - public Boolean critical() { - return this.innerProperties() == null ? null : this.innerProperties().critical(); - } - - /** - * Set the critical property: Whether or not the namespace is set as Critical. - * - * @param critical the critical value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withCritical(Boolean critical) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withCritical(critical); - return this; - } - - /** - * Get the dataCenter property: Data center for the namespace. - * - * @return the dataCenter value. - */ - public String dataCenter() { - return this.innerProperties() == null ? null : this.innerProperties().dataCenter(); - } - - /** - * Set the dataCenter property: Data center for the namespace. - * - * @param dataCenter the dataCenter value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withDataCenter(String dataCenter) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withDataCenter(dataCenter); - return this; - } - - /** - * Get the namespaceType property: The namespace type. - * - * @return the namespaceType value. - */ - public NamespaceType namespaceType() { - return this.innerProperties() == null ? null : this.innerProperties().namespaceType(); - } - - /** - * Set the namespaceType property: The namespace type. - * - * @param namespaceType the namespaceType value to set. - * @return the NamespaceCreateOrUpdateParameters object itself. - */ - public NamespaceCreateOrUpdateParameters withNamespaceType(NamespaceType namespaceType) { - if (this.innerProperties() == null) { - this.innerProperties = new NamespaceProperties(); - } - this.innerProperties().withNamespaceType(namespaceType); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } - if (sku() != null) { - sku().validate(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeJsonField("sku", this.sku); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NamespaceCreateOrUpdateParameters from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NamespaceCreateOrUpdateParameters if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NamespaceCreateOrUpdateParameters. - */ - public static NamespaceCreateOrUpdateParameters fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NamespaceCreateOrUpdateParameters deserializedNamespaceCreateOrUpdateParameters - = new NamespaceCreateOrUpdateParameters(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedNamespaceCreateOrUpdateParameters.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedNamespaceCreateOrUpdateParameters.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedNamespaceCreateOrUpdateParameters.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedNamespaceCreateOrUpdateParameters.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedNamespaceCreateOrUpdateParameters.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedNamespaceCreateOrUpdateParameters.innerProperties - = NamespaceProperties.fromJson(reader); - } else if ("sku".equals(fieldName)) { - deserializedNamespaceCreateOrUpdateParameters.sku = Sku.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedNamespaceCreateOrUpdateParameters; - }); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespacePatchParameters.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespacePatchParameters.java index 1a4b75b1bae4..19a79770d25f 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespacePatchParameters.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespacePatchParameters.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; @@ -9,23 +9,29 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceProperties; import java.io.IOException; import java.util.Map; /** - * Parameters supplied to the Patch Namespace operation. + * Patch parameter for NamespaceResource. */ @Fluent public final class NamespacePatchParameters implements JsonSerializable { /* - * Resource tags + * The Sku description for a namespace */ - private Map tags; + private Sku sku; /* - * The sku of the created namespace + * Represents namespace properties. */ - private Sku sku; + private NamespaceProperties properties; + + /* + * Dictionary of + */ + private Map tags; /** * Creates an instance of NamespacePatchParameters class. @@ -34,42 +40,62 @@ public NamespacePatchParameters() { } /** - * Get the tags property: Resource tags. + * Get the sku property: The Sku description for a namespace. * - * @return the tags value. + * @return the sku value. */ - public Map tags() { - return this.tags; + public Sku sku() { + return this.sku; } /** - * Set the tags property: Resource tags. + * Set the sku property: The Sku description for a namespace. * - * @param tags the tags value to set. + * @param sku the sku value to set. * @return the NamespacePatchParameters object itself. */ - public NamespacePatchParameters withTags(Map tags) { - this.tags = tags; + public NamespacePatchParameters withSku(Sku sku) { + this.sku = sku; return this; } /** - * Get the sku property: The sku of the created namespace. + * Get the properties property: Represents namespace properties. * - * @return the sku value. + * @return the properties value. */ - public Sku sku() { - return this.sku; + public NamespaceProperties properties() { + return this.properties; } /** - * Set the sku property: The sku of the created namespace. + * Set the properties property: Represents namespace properties. * - * @param sku the sku value to set. + * @param properties the properties value to set. * @return the NamespacePatchParameters object itself. */ - public NamespacePatchParameters withSku(Sku sku) { - this.sku = sku; + public NamespacePatchParameters withProperties(NamespaceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Dictionary of <string>. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Dictionary of <string>. + * + * @param tags the tags value to set. + * @return the NamespacePatchParameters object itself. + */ + public NamespacePatchParameters withTags(Map tags) { + this.tags = tags; return this; } @@ -82,6 +108,9 @@ public void validate() { if (sku() != null) { sku().validate(); } + if (properties() != null) { + properties().validate(); + } } /** @@ -90,8 +119,9 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); return jsonWriter.writeEndObject(); } @@ -110,11 +140,13 @@ public static NamespacePatchParameters fromJson(JsonReader jsonReader) throws IO String fieldName = reader.getFieldName(); reader.nextToken(); - if ("tags".equals(fieldName)) { + if ("sku".equals(fieldName)) { + deserializedNamespacePatchParameters.sku = Sku.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedNamespacePatchParameters.properties = NamespaceProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); deserializedNamespacePatchParameters.tags = tags; - } else if ("sku".equals(fieldName)) { - deserializedNamespacePatchParameters.sku = Sku.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceResource.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceResource.java index c748d6859978..db574cc24cfd 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceResource.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceResource.java @@ -1,13 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; +import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceProperties; import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; +import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentials; import java.time.OffsetDateTime; +import java.util.List; import java.util.Map; /** @@ -50,113 +55,163 @@ public interface NamespaceResource { Map tags(); /** - * Gets the sku property: The sku of the created namespace. + * Gets the sku property: The Sku description for a namespace. * * @return the sku value. */ Sku sku(); /** - * Gets the namePropertiesName property: The name of the namespace. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the namePropertiesName property: Name of the Notification Hubs namespace. This is immutable property, set + * automatically + * by the service when the namespace is created. * * @return the namePropertiesName value. */ String namePropertiesName(); /** - * Gets the provisioningState property: Provisioning state of the Namespace. + * Gets the provisioningState property: Defines values for OperationProvisioningState. * * @return the provisioningState value. */ - String provisioningState(); + OperationProvisioningState provisioningState(); /** - * Gets the region property: 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. + * Gets the status property: Namespace status. * - * @return the region value. + * @return the status value. */ - String region(); + NamespaceStatus status(); /** - * Gets the metricId property: Identifier for Azure Insights metrics. + * Gets the enabled property: Gets or sets whether or not the namespace is currently enabled. * - * @return the metricId value. + * @return the enabled value. */ - String metricId(); + Boolean enabled(); /** - * Gets the status property: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 - * = Suspended4 = Deleting. + * Gets the critical property: Gets or sets whether or not the namespace is set as Critical. * - * @return the status value. + * @return the critical value. */ - String status(); + Boolean critical(); /** - * Gets the createdAt property: The time the namespace was created. + * Gets the subscriptionId property: Namespace subscription id. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the region property: Region. The value is always set to the same value as Namespace.Location, so we are + * deprecating + * this property. + * + * @return the region value. + */ + String region(); + + /** + * Gets the metricId property: Azure Insights Metrics id. + * + * @return the metricId value. + */ + String metricId(); + + /** + * Gets the createdAt property: Time when the namespace was created. * * @return the createdAt value. */ OffsetDateTime createdAt(); /** - * Gets the updatedAt property: The time the namespace was updated. + * Gets the updatedAt property: Time when the namespace was updated. * * @return the updatedAt value. */ OffsetDateTime updatedAt(); /** - * Gets the serviceBusEndpoint property: Endpoint you can use to perform NotificationHub operations. + * Gets the namespaceType property: Defines values for NamespaceType. * - * @return the serviceBusEndpoint value. + * @return the namespaceType value. */ - String serviceBusEndpoint(); + NamespaceType namespaceType(); /** - * Gets the subscriptionId property: The Id of the Azure subscription associated with the namespace. + * Gets the replicationRegion property: Allowed replication region. * - * @return the subscriptionId value. + * @return the replicationRegion value. */ - String subscriptionId(); + ReplicationRegion replicationRegion(); /** - * Gets the scaleUnit property: ScaleUnit where the namespace gets created. + * Gets the zoneRedundancy property: Namespace SKU name. * - * @return the scaleUnit value. + * @return the zoneRedundancy value. */ - String scaleUnit(); + ZoneRedundancyPreference zoneRedundancy(); /** - * Gets the enabled property: Whether or not the namespace is currently enabled. + * Gets the networkAcls property: A collection of network authorization rules. * - * @return the enabled value. + * @return the networkAcls value. */ - Boolean enabled(); + NetworkAcls networkAcls(); /** - * Gets the critical property: Whether or not the namespace is set as Critical. + * Gets the pnsCredentials property: Collection of Notification Hub or Notification Hub Namespace PNS credentials. * - * @return the critical value. + * @return the pnsCredentials value. */ - Boolean critical(); + PnsCredentials pnsCredentials(); + + /** + * Gets the serviceBusEndpoint property: Gets or sets endpoint you can use to perform NotificationHub + * operations. + * + * @return the serviceBusEndpoint value. + */ + String serviceBusEndpoint(); + + /** + * Gets the privateEndpointConnections property: Private Endpoint Connections for namespace. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the scaleUnit property: Gets or sets scaleUnit where the namespace gets created. + * + * @return the scaleUnit value. + */ + String scaleUnit(); /** - * Gets the dataCenter property: Data center for the namespace. + * Gets the dataCenter property: Deprecated. * * @return the dataCenter value. */ String dataCenter(); /** - * Gets the namespaceType property: The namespace type. + * Gets the publicNetworkAccess property: Type of public network access. * - * @return the namespaceType value. + * @return the publicNetworkAccess value. */ - NamespaceType namespaceType(); + PublicNetworkAccess publicNetworkAccess(); /** * Gets the name of the resource group. @@ -176,7 +231,7 @@ public interface NamespaceResource { * The entirety of the NamespaceResource definition. */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + DefinitionStages.WithResourceGroup, DefinitionStages.WithSku, DefinitionStages.WithCreate { } /** @@ -199,7 +254,7 @@ interface WithLocation { * @param location The geo-location where the resource lives. * @return the next definition stage. */ - WithResourceGroup withLocation(Region location); + WithResourceGroup withRegion(Region location); /** * Specifies the region for the resource. @@ -207,7 +262,7 @@ interface WithLocation { * @param location The geo-location where the resource lives. * @return the next definition stage. */ - WithResourceGroup withLocation(String location); + WithResourceGroup withRegion(String location); } /** @@ -217,22 +272,33 @@ interface WithResourceGroup { /** * Specifies resourceGroupName. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithSku withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the NamespaceResource definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: The Sku description for a namespace. + * + * @param sku The Sku description for a namespace. * @return the next definition stage. */ - WithCreate withExistingResourceGroup(String resourceGroupName); + WithCreate withSku(Sku sku); } /** * The stage of the NamespaceResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. */ - interface WithCreate - extends DefinitionStages.WithTags, DefinitionStages.WithSku, DefinitionStages.WithNamePropertiesName, - DefinitionStages.WithProvisioningState, DefinitionStages.WithRegion, DefinitionStages.WithStatus, - DefinitionStages.WithCreatedAt, DefinitionStages.WithUpdatedAt, DefinitionStages.WithServiceBusEndpoint, - DefinitionStages.WithSubscriptionId, DefinitionStages.WithScaleUnit, DefinitionStages.WithEnabled, - DefinitionStages.WithCritical, DefinitionStages.WithDataCenter, DefinitionStages.WithNamespaceType { + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProvisioningState, + DefinitionStages.WithStatus, DefinitionStages.WithNamespaceType, DefinitionStages.WithReplicationRegion, + DefinitionStages.WithZoneRedundancy, DefinitionStages.WithNetworkAcls, DefinitionStages.WithPnsCredentials, + DefinitionStages.WithScaleUnit, DefinitionStages.WithDataCenter, DefinitionStages.WithPublicNetworkAccess { /** * Executes the create request. * @@ -262,129 +328,96 @@ interface WithTags { WithCreate withTags(Map tags); } - /** - * The stage of the NamespaceResource definition allowing to specify sku. - */ - interface WithSku { - /** - * Specifies the sku property: The sku of the created namespace. - * - * @param sku The sku of the created namespace. - * @return the next definition stage. - */ - WithCreate withSku(Sku sku); - } - - /** - * The stage of the NamespaceResource definition allowing to specify namePropertiesName. - */ - interface WithNamePropertiesName { - /** - * Specifies the namePropertiesName property: The name of the namespace.. - * - * @param namePropertiesName The name of the namespace. - * @return the next definition stage. - */ - WithCreate withNamePropertiesName(String namePropertiesName); - } - /** * The stage of the NamespaceResource definition allowing to specify provisioningState. */ interface WithProvisioningState { /** - * Specifies the provisioningState property: Provisioning state of the Namespace.. + * Specifies the provisioningState property: Defines values for OperationProvisioningState.. * - * @param provisioningState Provisioning state of the Namespace. + * @param provisioningState Defines values for OperationProvisioningState. * @return the next definition stage. */ - WithCreate withProvisioningState(String provisioningState); + WithCreate withProvisioningState(OperationProvisioningState provisioningState); } /** - * The stage of the NamespaceResource definition allowing to specify region. + * The stage of the NamespaceResource definition allowing to specify status. */ - interface WithRegion { + interface WithStatus { /** - * Specifies the region property: 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. + * Specifies the status property: Namespace status.. * - * @param region 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. + * @param status Namespace status. * @return the next definition stage. */ - WithCreate withRegion(String region); + WithCreate withStatus(NamespaceStatus status); } /** - * The stage of the NamespaceResource definition allowing to specify status. + * The stage of the NamespaceResource definition allowing to specify namespaceType. */ - interface WithStatus { + interface WithNamespaceType { /** - * Specifies the status property: Status of the namespace. It can be any of these values:1 = Created/Active2 - * = Creating3 = Suspended4 = Deleting. + * Specifies the namespaceType property: Defines values for NamespaceType.. * - * @param status Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = - * Suspended4 = Deleting. + * @param namespaceType Defines values for NamespaceType. * @return the next definition stage. */ - WithCreate withStatus(String status); + WithCreate withNamespaceType(NamespaceType namespaceType); } /** - * The stage of the NamespaceResource definition allowing to specify createdAt. + * The stage of the NamespaceResource definition allowing to specify replicationRegion. */ - interface WithCreatedAt { + interface WithReplicationRegion { /** - * Specifies the createdAt property: The time the namespace was created.. + * Specifies the replicationRegion property: Allowed replication region. * - * @param createdAt The time the namespace was created. + * @param replicationRegion Allowed replication region. * @return the next definition stage. */ - WithCreate withCreatedAt(OffsetDateTime createdAt); + WithCreate withReplicationRegion(ReplicationRegion replicationRegion); } /** - * The stage of the NamespaceResource definition allowing to specify updatedAt. + * The stage of the NamespaceResource definition allowing to specify zoneRedundancy. */ - interface WithUpdatedAt { + interface WithZoneRedundancy { /** - * Specifies the updatedAt property: The time the namespace was updated.. + * Specifies the zoneRedundancy property: Namespace SKU name.. * - * @param updatedAt The time the namespace was updated. + * @param zoneRedundancy Namespace SKU name. * @return the next definition stage. */ - WithCreate withUpdatedAt(OffsetDateTime updatedAt); + WithCreate withZoneRedundancy(ZoneRedundancyPreference zoneRedundancy); } /** - * The stage of the NamespaceResource definition allowing to specify serviceBusEndpoint. + * The stage of the NamespaceResource definition allowing to specify networkAcls. */ - interface WithServiceBusEndpoint { + interface WithNetworkAcls { /** - * Specifies the serviceBusEndpoint property: Endpoint you can use to perform NotificationHub operations.. + * Specifies the networkAcls property: A collection of network authorization rules.. * - * @param serviceBusEndpoint Endpoint you can use to perform NotificationHub operations. + * @param networkAcls A collection of network authorization rules. * @return the next definition stage. */ - WithCreate withServiceBusEndpoint(String serviceBusEndpoint); + WithCreate withNetworkAcls(NetworkAcls networkAcls); } /** - * The stage of the NamespaceResource definition allowing to specify subscriptionId. + * The stage of the NamespaceResource definition allowing to specify pnsCredentials. */ - interface WithSubscriptionId { + interface WithPnsCredentials { /** - * Specifies the subscriptionId property: The Id of the Azure subscription associated with the namespace.. + * Specifies the pnsCredentials property: Collection of Notification Hub or Notification Hub Namespace PNS + * credentials.. * - * @param subscriptionId The Id of the Azure subscription associated with the namespace. + * @param pnsCredentials Collection of Notification Hub or Notification Hub Namespace PNS credentials. * @return the next definition stage. */ - WithCreate withSubscriptionId(String subscriptionId); + WithCreate withPnsCredentials(PnsCredentials pnsCredentials); } /** @@ -392,64 +425,38 @@ interface WithSubscriptionId { */ interface WithScaleUnit { /** - * Specifies the scaleUnit property: ScaleUnit where the namespace gets created. + * Specifies the scaleUnit property: Gets or sets scaleUnit where the namespace gets created. * - * @param scaleUnit ScaleUnit where the namespace gets created. + * @param scaleUnit Gets or sets scaleUnit where the namespace gets created. * @return the next definition stage. */ WithCreate withScaleUnit(String scaleUnit); } - /** - * The stage of the NamespaceResource definition allowing to specify enabled. - */ - interface WithEnabled { - /** - * Specifies the enabled property: Whether or not the namespace is currently enabled.. - * - * @param enabled Whether or not the namespace is currently enabled. - * @return the next definition stage. - */ - WithCreate withEnabled(Boolean enabled); - } - - /** - * The stage of the NamespaceResource definition allowing to specify critical. - */ - interface WithCritical { - /** - * Specifies the critical property: Whether or not the namespace is set as Critical.. - * - * @param critical Whether or not the namespace is set as Critical. - * @return the next definition stage. - */ - WithCreate withCritical(Boolean critical); - } - /** * The stage of the NamespaceResource definition allowing to specify dataCenter. */ interface WithDataCenter { /** - * Specifies the dataCenter property: Data center for the namespace. + * Specifies the dataCenter property: Deprecated.. * - * @param dataCenter Data center for the namespace. + * @param dataCenter Deprecated. * @return the next definition stage. */ WithCreate withDataCenter(String dataCenter); } /** - * The stage of the NamespaceResource definition allowing to specify namespaceType. + * The stage of the NamespaceResource definition allowing to specify publicNetworkAccess. */ - interface WithNamespaceType { + interface WithPublicNetworkAccess { /** - * Specifies the namespaceType property: The namespace type.. + * Specifies the publicNetworkAccess property: Type of public network access.. * - * @param namespaceType The namespace type. + * @param publicNetworkAccess Type of public network access. * @return the next definition stage. */ - WithCreate withNamespaceType(NamespaceType namespaceType); + WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); } } @@ -463,7 +470,7 @@ interface WithNamespaceType { /** * The template for NamespaceResource update. */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithSku { + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku, UpdateStages.WithProperties { /** * Executes the update request. * @@ -489,9 +496,9 @@ interface UpdateStages { */ interface WithTags { /** - * Specifies the tags property: Resource tags. + * Specifies the tags property: Dictionary of <string>. * - * @param tags Resource tags. + * @param tags Dictionary of <string>. * @return the next definition stage. */ Update withTags(Map tags); @@ -502,13 +509,26 @@ interface WithTags { */ interface WithSku { /** - * Specifies the sku property: The sku of the created namespace. + * Specifies the sku property: The Sku description for a namespace. * - * @param sku The sku of the created namespace. + * @param sku The Sku description for a namespace. * @return the next definition stage. */ Update withSku(Sku sku); } + + /** + * The stage of the NamespaceResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Represents namespace properties.. + * + * @param properties Represents namespace properties. + * @return the next definition stage. + */ + Update withProperties(NamespaceProperties properties); + } } /** @@ -525,4 +545,48 @@ interface WithSku { * @return the refreshed resource. */ NamespaceResource refresh(Context context); + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource along with {@link Response}. + */ + Response + checkNotificationHubAvailabilityWithResponse(CheckAvailabilityParameters parameters, Context context); + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource. + */ + CheckAvailabilityResult checkNotificationHubAvailability(CheckAvailabilityParameters parameters); + + /** + * Lists the PNS credentials associated with a namespace. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials along with {@link Response}. + */ + Response getPnsCredentialsWithResponse(Context context); + + /** + * Lists the PNS credentials associated with a namespace. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials. + */ + PnsCredentialsResource getPnsCredentials(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceResources.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceResources.java new file mode 100644 index 000000000000..fd0c9059ea71 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceResources.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of NamespaceResources. + */ +public interface NamespaceResources { + /** + * Returns the given namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String namespaceName, + Context context); + + /** + * Returns the given namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource. + */ + NamespaceResource getByResourceGroup(String resourceGroupName, String namespaceName); + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String namespaceName, Context context); + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String namespaceName); + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the available namespaces within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String skipToken, Integer top, + Context context); + + /** + * Lists all the available namespaces within the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all the available namespaces within the subscription. + * + * @param skipToken Skip token for subsequent requests. + * @param top Maximum number of results to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NamespaceResource items as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String skipToken, Integer top, Context context); + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource along with {@link Response}. + */ + Response checkNotificationHubAvailabilityWithResponse(String resourceGroupName, + String namespaceName, CheckAvailabilityParameters parameters, Context context); + + /** + * Checks the availability of the given notificationHub in a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource. + */ + CheckAvailabilityResult checkNotificationHubAvailability(String resourceGroupName, String namespaceName, + CheckAvailabilityParameters parameters); + + /** + * Lists the PNS credentials associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials along with {@link Response}. + */ + Response getPnsCredentialsWithResponse(String resourceGroupName, String namespaceName, + Context context); + + /** + * Lists the PNS credentials associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials. + */ + PnsCredentialsResource getPnsCredentials(String resourceGroupName, String namespaceName); + + /** + * Returns the given namespace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response}. + */ + NamespaceResource getById(String id); + + /** + * Returns the given namespace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification Hubs Namespace Resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NamespaceResource resource. + * + * @param name resource name. + * @return the first stage of the new NamespaceResource definition. + */ + NamespaceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceStatus.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceStatus.java new file mode 100644 index 000000000000..165dd60a02ee --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Namespace status. + */ +public final class NamespaceStatus extends ExpandableStringEnum { + /** + * Static value Created for NamespaceStatus. + */ + public static final NamespaceStatus CREATED = fromString("Created"); + + /** + * Static value Creating for NamespaceStatus. + */ + public static final NamespaceStatus CREATING = fromString("Creating"); + + /** + * Static value Suspended for NamespaceStatus. + */ + public static final NamespaceStatus SUSPENDED = fromString("Suspended"); + + /** + * Static value Deleting for NamespaceStatus. + */ + public static final NamespaceStatus DELETING = fromString("Deleting"); + + /** + * Creates a new instance of NamespaceStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NamespaceStatus() { + } + + /** + * Creates or finds a NamespaceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding NamespaceStatus. + */ + public static NamespaceStatus fromString(String name) { + return fromString(name, NamespaceStatus.class); + } + + /** + * Gets known NamespaceStatus values. + * + * @return known NamespaceStatus values. + */ + public static Collection values() { + return values(NamespaceStatus.class); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceType.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceType.java index b66386c35089..bca6b195e776 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceType.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespaceType.java @@ -1,56 +1,51 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + /** - * The namespace type. + * Defines values for NamespaceType. */ -public enum NamespaceType { +public final class NamespaceType extends ExpandableStringEnum { /** - * Enum value Messaging. + * Static value Messaging for NamespaceType. */ - MESSAGING("Messaging"), + public static final NamespaceType MESSAGING = fromString("Messaging"); /** - * Enum value NotificationHub. + * Static value NotificationHub for NamespaceType. */ - NOTIFICATION_HUB("NotificationHub"); + public static final NamespaceType NOTIFICATION_HUB = fromString("NotificationHub"); /** - * The actual serialized value for a NamespaceType instance. + * Creates a new instance of NamespaceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. */ - private final String value; - - NamespaceType(String value) { - this.value = value; + @Deprecated + public NamespaceType() { } /** - * Parses a serialized value to a NamespaceType instance. + * Creates or finds a NamespaceType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed NamespaceType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding NamespaceType. */ - public static NamespaceType fromString(String value) { - if (value == null) { - return null; - } - NamespaceType[] items = NamespaceType.values(); - for (NamespaceType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static NamespaceType fromString(String name) { + return fromString(name, NamespaceType.class); } /** - * {@inheritDoc} + * Gets known NamespaceType values. + * + * @return known NamespaceType values. */ - @Override - public String toString() { - return this.value; + public static Collection values() { + return values(NamespaceType.class); } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Namespaces.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Namespaces.java index 853707ba44b5..633f20166eed 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Namespaces.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Namespaces.java @@ -1,98 +1,85 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; /** * Resource collection API of Namespaces. */ public interface Namespaces { /** - * 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 an authorization rule for a namespace by name. * - * @param parameters The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response}. - */ - Response checkAvailabilityWithResponse(CheckAvailabilityParameters parameters, - Context context); - - /** - * 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. - * - * @param parameters The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource. - */ - CheckAvailabilityResult checkAvailability(CheckAvailabilityParameters parameters); - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a namespace by name along with {@link Response}. */ - void deleteByResourceGroup(String resourceGroupName, String namespaceName); + Response getAuthorizationRuleWithResponse(String resourceGroupName, + String namespaceName, String authorizationRuleName, Context context); /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. + * Gets an authorization rule for a namespace by name. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a namespace by name. */ - void delete(String resourceGroupName, String namespaceName, Context context); + SharedAccessAuthorizationRuleResource getAuthorizationRule(String resourceGroupName, String namespaceName, + String authorizationRuleName); /** - * Returns the description for the specified namespace. + * Creates an authorization rule for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response}. + * @return response for POST requests that return single SharedAccessAuthorizationRule along with {@link Response}. */ - Response getByResourceGroupWithResponse(String resourceGroupName, String namespaceName, - Context context); + Response createOrUpdateAuthorizationRuleWithResponse( + String resourceGroupName, String namespaceName, String authorizationRuleName, + SharedAccessAuthorizationRuleResourceInner parameters, Context context); /** - * Returns the description for the specified namespace. + * Creates an authorization rule for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource. + * @return response for POST requests that return single SharedAccessAuthorizationRule. */ - NamespaceResource getByResourceGroup(String resourceGroupName, String namespaceName); + SharedAccessAuthorizationRuleResource createOrUpdateAuthorizationRule(String resourceGroupName, + String namespaceName, String authorizationRuleName, SharedAccessAuthorizationRuleResourceInner parameters); /** * Deletes a namespace authorization rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -105,94 +92,20 @@ Response deleteAuthorizationRuleWithResponse(String resourceGroupName, Str /** * Deletes a namespace authorization rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization Rule Name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName); - /** - * Gets an authorization rule for a namespace by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization rule name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name along with {@link Response}. - */ - Response getAuthorizationRuleWithResponse(String resourceGroupName, - String namespaceName, String authorizationRuleName, Context context); - - /** - * Gets an authorization rule for a namespace by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName Authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name. - */ - SharedAccessAuthorizationRuleResource getAuthorizationRule(String resourceGroupName, String namespaceName, - String authorizationRuleName); - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * Lists the available namespaces within a resourceGroup. - * - * @param resourceGroupName The name of the resource group. If resourceGroupName value is null the method lists all - * the namespaces within subscription. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName, Context context); - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * Lists all the available namespaces within the subscription irrespective of the resourceGroups. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List Namespace operation as paginated response with {@link PagedIterable}. - */ - PagedIterable list(Context context); - /** * Gets the authorization rules for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -204,8 +117,8 @@ PagedIterable listAuthorizationRules(Stri /** * Gets the authorization rules for a namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -218,9 +131,9 @@ PagedIterable listAuthorizationRules(Stri /** * Gets the Primary and Secondary ConnectionStrings to the namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -233,9 +146,9 @@ Response listKeysWithResponse(String resourceGroupName, String /** * Gets the Primary and Secondary ConnectionStrings to the namespace. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -246,136 +159,32 @@ Response listKeysWithResponse(String resourceGroupName, String /** * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response}. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * along with {@link Response}. */ Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, - String authorizationRuleName, PolicykeyResource parameters, Context context); + String authorizationRuleName, PolicyKeyResource parameters, Context context); /** * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param authorizationRuleName The connection string of the namespace for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings). */ ResourceListKeys regenerateKeys(String resourceGroupName, String namespaceName, String authorizationRuleName, - PolicykeyResource parameters); - - /** - * Returns the description for the specified namespace. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response}. - */ - NamespaceResource getById(String id); - - /** - * Returns the description for the specified namespace. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace resource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Gets an authorization rule for a namespace by name. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name along with {@link Response}. - */ - SharedAccessAuthorizationRuleResource getAuthorizationRuleById(String id); - - /** - * Gets an authorization rule for a namespace by name. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a namespace by name along with {@link Response}. - */ - Response getAuthorizationRuleByIdWithResponse(String id, Context context); - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByIdWithResponse(String id, Context context); - - /** - * Deletes a namespace authorization rule. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteAuthorizationRuleById(String id); - - /** - * Deletes a namespace authorization rule. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteAuthorizationRuleByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new NamespaceResource resource. - * - * @param name resource name. - * @return the first stage of the new NamespaceResource definition. - */ - NamespaceResource.DefinitionStages.Blank define(String name); - - /** - * Begins definition for a new SharedAccessAuthorizationRuleResource resource. - * - * @param name resource name. - * @return the first stage of the new SharedAccessAuthorizationRuleResource definition. - */ - SharedAccessAuthorizationRuleResource.DefinitionStages.Blank defineAuthorizationRule(String name); + PolicyKeyResource parameters); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespacesOperationGroups.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespacesOperationGroups.java new file mode 100644 index 000000000000..1e645c060476 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NamespacesOperationGroups.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of NamespacesOperationGroups. + */ +public interface NamespacesOperationGroups { + /** + * 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. + * + * @param parameters The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource along with {@link Response}. + */ + Response checkAvailabilityWithResponse(CheckAvailabilityParameters parameters, + Context context); + + /** + * 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. + * + * @param parameters The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a CheckAvailability resource. + */ + CheckAvailabilityResult checkAvailability(CheckAvailabilityParameters parameters); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NetworkAcls.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NetworkAcls.java new file mode 100644 index 000000000000..26ff863bd5ed --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NetworkAcls.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A collection of network authorization rules. + */ +@Fluent +public final class NetworkAcls implements JsonSerializable { + /* + * List of IP rules. + */ + private List ipRules; + + /* + * A default (public Internet) network authorization rule, which contains rights if no other network rule matches. + */ + private PublicInternetAuthorizationRule publicNetworkRule; + + /** + * Creates an instance of NetworkAcls class. + */ + public NetworkAcls() { + } + + /** + * Get the ipRules property: List of IP rules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: List of IP rules. + * + * @param ipRules the ipRules value to set. + * @return the NetworkAcls object itself. + */ + public NetworkAcls withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the publicNetworkRule property: A default (public Internet) network authorization rule, which contains rights + * if no other network rule matches. + * + * @return the publicNetworkRule value. + */ + public PublicInternetAuthorizationRule publicNetworkRule() { + return this.publicNetworkRule; + } + + /** + * Set the publicNetworkRule property: A default (public Internet) network authorization rule, which contains rights + * if no other network rule matches. + * + * @param publicNetworkRule the publicNetworkRule value to set. + * @return the NetworkAcls object itself. + */ + public NetworkAcls withPublicNetworkRule(PublicInternetAuthorizationRule publicNetworkRule) { + this.publicNetworkRule = publicNetworkRule; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + if (publicNetworkRule() != null) { + publicNetworkRule().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ipRules", this.ipRules, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("publicNetworkRule", this.publicNetworkRule); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkAcls from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkAcls if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the NetworkAcls. + */ + public static NetworkAcls fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkAcls deserializedNetworkAcls = new NetworkAcls(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipRules".equals(fieldName)) { + List ipRules = reader.readArray(reader1 -> IpRule.fromJson(reader1)); + deserializedNetworkAcls.ipRules = ipRules; + } else if ("publicNetworkRule".equals(fieldName)) { + deserializedNetworkAcls.publicNetworkRule = PublicInternetAuthorizationRule.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkAcls; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubCreateOrUpdateParameters.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubCreateOrUpdateParameters.java deleted file mode 100644 index dee23070bbce..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubCreateOrUpdateParameters.java +++ /dev/null @@ -1,414 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubProperties; -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * Parameters supplied to the CreateOrUpdate NotificationHub operation. - */ -@Fluent -public final class NotificationHubCreateOrUpdateParameters extends Resource { - /* - * Properties of the NotificationHub. - */ - private NotificationHubProperties innerProperties = new NotificationHubProperties(); - - /* - * The sku of the created namespace - */ - private Sku sku; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of NotificationHubCreateOrUpdateParameters class. - */ - public NotificationHubCreateOrUpdateParameters() { - } - - /** - * Get the innerProperties property: Properties of the NotificationHub. - * - * @return the innerProperties value. - */ - private NotificationHubProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the sku property: The sku of the created namespace. - * - * @return the sku value. - */ - public Sku sku() { - return this.sku; - } - - /** - * Set the sku property: The sku of the created namespace. - * - * @param sku the sku value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters withSku(Sku sku) { - this.sku = sku; - return this; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public NotificationHubCreateOrUpdateParameters withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public NotificationHubCreateOrUpdateParameters withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the name property: The NotificationHub name. - * - * @return the name value. - */ - public String namePropertiesName() { - return this.innerProperties() == null ? null : this.innerProperties().name(); - } - - /** - * Set the name property: The NotificationHub name. - * - * @param name the name value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters withNamePropertiesName(String name) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withName(name); - return this; - } - - /** - * Get the registrationTtl property: The RegistrationTtl of the created NotificationHub. - * - * @return the registrationTtl value. - */ - public String registrationTtl() { - return this.innerProperties() == null ? null : this.innerProperties().registrationTtl(); - } - - /** - * Set the registrationTtl property: The RegistrationTtl of the created NotificationHub. - * - * @param registrationTtl the registrationTtl value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters withRegistrationTtl(String registrationTtl) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withRegistrationTtl(registrationTtl); - return this; - } - - /** - * Get the authorizationRules property: The AuthorizationRules of the created NotificationHub. - * - * @return the authorizationRules value. - */ - public List authorizationRules() { - return this.innerProperties() == null ? null : this.innerProperties().authorizationRules(); - } - - /** - * Set the authorizationRules property: The AuthorizationRules of the created NotificationHub. - * - * @param authorizationRules the authorizationRules value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters - withAuthorizationRules(List authorizationRules) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withAuthorizationRules(authorizationRules); - return this; - } - - /** - * Get the apnsCredential property: The ApnsCredential of the created NotificationHub. - * - * @return the apnsCredential value. - */ - public ApnsCredential apnsCredential() { - return this.innerProperties() == null ? null : this.innerProperties().apnsCredential(); - } - - /** - * Set the apnsCredential property: The ApnsCredential of the created NotificationHub. - * - * @param apnsCredential the apnsCredential value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters withApnsCredential(ApnsCredential apnsCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withApnsCredential(apnsCredential); - return this; - } - - /** - * Get the wnsCredential property: The WnsCredential of the created NotificationHub. - * - * @return the wnsCredential value. - */ - public WnsCredential wnsCredential() { - return this.innerProperties() == null ? null : this.innerProperties().wnsCredential(); - } - - /** - * Set the wnsCredential property: The WnsCredential of the created NotificationHub. - * - * @param wnsCredential the wnsCredential value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters withWnsCredential(WnsCredential wnsCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withWnsCredential(wnsCredential); - return this; - } - - /** - * Get the gcmCredential property: The GcmCredential of the created NotificationHub. - * - * @return the gcmCredential value. - */ - public GcmCredential gcmCredential() { - return this.innerProperties() == null ? null : this.innerProperties().gcmCredential(); - } - - /** - * Set the gcmCredential property: The GcmCredential of the created NotificationHub. - * - * @param gcmCredential the gcmCredential value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters withGcmCredential(GcmCredential gcmCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withGcmCredential(gcmCredential); - return this; - } - - /** - * Get the mpnsCredential property: The MpnsCredential of the created NotificationHub. - * - * @return the mpnsCredential value. - */ - public MpnsCredential mpnsCredential() { - return this.innerProperties() == null ? null : this.innerProperties().mpnsCredential(); - } - - /** - * Set the mpnsCredential property: The MpnsCredential of the created NotificationHub. - * - * @param mpnsCredential the mpnsCredential value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters withMpnsCredential(MpnsCredential mpnsCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withMpnsCredential(mpnsCredential); - return this; - } - - /** - * Get the admCredential property: The AdmCredential of the created NotificationHub. - * - * @return the admCredential value. - */ - public AdmCredential admCredential() { - return this.innerProperties() == null ? null : this.innerProperties().admCredential(); - } - - /** - * Set the admCredential property: The AdmCredential of the created NotificationHub. - * - * @param admCredential the admCredential value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters withAdmCredential(AdmCredential admCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withAdmCredential(admCredential); - return this; - } - - /** - * Get the baiduCredential property: The BaiduCredential of the created NotificationHub. - * - * @return the baiduCredential value. - */ - public BaiduCredential baiduCredential() { - return this.innerProperties() == null ? null : this.innerProperties().baiduCredential(); - } - - /** - * Set the baiduCredential property: The BaiduCredential of the created NotificationHub. - * - * @param baiduCredential the baiduCredential value to set. - * @return the NotificationHubCreateOrUpdateParameters object itself. - */ - public NotificationHubCreateOrUpdateParameters withBaiduCredential(BaiduCredential baiduCredential) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withBaiduCredential(baiduCredential); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerProperties in model NotificationHubCreateOrUpdateParameters")); - } else { - innerProperties().validate(); - } - if (sku() != null) { - sku().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(NotificationHubCreateOrUpdateParameters.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeJsonField("sku", this.sku); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NotificationHubCreateOrUpdateParameters from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NotificationHubCreateOrUpdateParameters if the JsonReader was pointing to an instance of - * it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NotificationHubCreateOrUpdateParameters. - */ - public static NotificationHubCreateOrUpdateParameters fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NotificationHubCreateOrUpdateParameters deserializedNotificationHubCreateOrUpdateParameters - = new NotificationHubCreateOrUpdateParameters(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedNotificationHubCreateOrUpdateParameters.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedNotificationHubCreateOrUpdateParameters.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedNotificationHubCreateOrUpdateParameters.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedNotificationHubCreateOrUpdateParameters.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedNotificationHubCreateOrUpdateParameters.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedNotificationHubCreateOrUpdateParameters.innerProperties - = NotificationHubProperties.fromJson(reader); - } else if ("sku".equals(fieldName)) { - deserializedNotificationHubCreateOrUpdateParameters.sku = Sku.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedNotificationHubCreateOrUpdateParameters; - }); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubPatchParameters.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubPatchParameters.java index c3467d174680..0096f866e9fe 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubPatchParameters.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubPatchParameters.java @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubProperties; @@ -16,34 +16,24 @@ import java.util.Map; /** - * Parameters supplied to the patch NotificationHub operation. + * Patch parameter for NamespaceResource. */ @Fluent -public final class NotificationHubPatchParameters extends Resource { +public final class NotificationHubPatchParameters implements JsonSerializable { /* - * Properties of the NotificationHub. + * NotificationHub properties. */ private NotificationHubProperties innerProperties; /* - * The sku of the created namespace + * The Sku description for a namespace */ private Sku sku; /* - * The type of the resource. + * Dictionary of */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; + private Map tags; /** * Creates an instance of NotificationHubPatchParameters class. @@ -52,7 +42,7 @@ public NotificationHubPatchParameters() { } /** - * Get the innerProperties property: Properties of the NotificationHub. + * Get the innerProperties property: NotificationHub properties. * * @return the innerProperties value. */ @@ -61,7 +51,7 @@ private NotificationHubProperties innerProperties() { } /** - * Get the sku property: The sku of the created namespace. + * Get the sku property: The Sku description for a namespace. * * @return the sku value. */ @@ -70,7 +60,7 @@ public Sku sku() { } /** - * Set the sku property: The sku of the created namespace. + * Set the sku property: The Sku description for a namespace. * * @param sku the sku value to set. * @return the NotificationHubPatchParameters object itself. @@ -81,69 +71,41 @@ public NotificationHubPatchParameters withSku(Sku sku) { } /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. + * Get the tags property: Dictionary of <string>. * - * @return the name value. + * @return the tags value. */ - @Override - public String name() { - return this.name; + public Map tags() { + return this.tags; } /** - * Get the id property: Fully qualified resource Id for the resource. + * Set the tags property: Dictionary of <string>. * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public NotificationHubPatchParameters withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} + * @param tags the tags value to set. + * @return the NotificationHubPatchParameters object itself. */ - @Override public NotificationHubPatchParameters withTags(Map tags) { - super.withTags(tags); + this.tags = tags; return this; } /** - * Get the name property: The NotificationHub name. + * Get the name property: Gets or sets the NotificationHub name. * * @return the name value. */ - public String namePropertiesName() { + public String name() { return this.innerProperties() == null ? null : this.innerProperties().name(); } /** - * Set the name property: The NotificationHub name. + * Set the name property: Gets or sets the NotificationHub name. * * @param name the name value to set. * @return the NotificationHubPatchParameters object itself. */ - public NotificationHubPatchParameters withNamePropertiesName(String name) { + public NotificationHubPatchParameters withName(String name) { if (this.innerProperties() == null) { this.innerProperties = new NotificationHubProperties(); } @@ -152,7 +114,7 @@ public NotificationHubPatchParameters withNamePropertiesName(String name) { } /** - * Get the registrationTtl property: The RegistrationTtl of the created NotificationHub. + * Get the registrationTtl property: Gets or sets the RegistrationTtl of the created NotificationHub. * * @return the registrationTtl value. */ @@ -161,7 +123,7 @@ public String registrationTtl() { } /** - * Set the registrationTtl property: The RegistrationTtl of the created NotificationHub. + * Set the registrationTtl property: Gets or sets the RegistrationTtl of the created NotificationHub. * * @param registrationTtl the registrationTtl value to set. * @return the NotificationHubPatchParameters object itself. @@ -175,7 +137,7 @@ public NotificationHubPatchParameters withRegistrationTtl(String registrationTtl } /** - * Get the authorizationRules property: The AuthorizationRules of the created NotificationHub. + * Get the authorizationRules property: Gets or sets the AuthorizationRules of the created NotificationHub. * * @return the authorizationRules value. */ @@ -184,22 +146,7 @@ public List authorizationRules() { } /** - * Set the authorizationRules property: The AuthorizationRules of the created NotificationHub. - * - * @param authorizationRules the authorizationRules value to set. - * @return the NotificationHubPatchParameters object itself. - */ - public NotificationHubPatchParameters - withAuthorizationRules(List authorizationRules) { - if (this.innerProperties() == null) { - this.innerProperties = new NotificationHubProperties(); - } - this.innerProperties().withAuthorizationRules(authorizationRules); - return this; - } - - /** - * Get the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Get the apnsCredential property: Description of a NotificationHub ApnsCredential. * * @return the apnsCredential value. */ @@ -208,7 +155,7 @@ public ApnsCredential apnsCredential() { } /** - * Set the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Set the apnsCredential property: Description of a NotificationHub ApnsCredential. * * @param apnsCredential the apnsCredential value to set. * @return the NotificationHubPatchParameters object itself. @@ -222,7 +169,7 @@ public NotificationHubPatchParameters withApnsCredential(ApnsCredential apnsCred } /** - * Get the wnsCredential property: The WnsCredential of the created NotificationHub. + * Get the wnsCredential property: Description of a NotificationHub WnsCredential. * * @return the wnsCredential value. */ @@ -231,7 +178,7 @@ public WnsCredential wnsCredential() { } /** - * Set the wnsCredential property: The WnsCredential of the created NotificationHub. + * Set the wnsCredential property: Description of a NotificationHub WnsCredential. * * @param wnsCredential the wnsCredential value to set. * @return the NotificationHubPatchParameters object itself. @@ -245,7 +192,7 @@ public NotificationHubPatchParameters withWnsCredential(WnsCredential wnsCredent } /** - * Get the gcmCredential property: The GcmCredential of the created NotificationHub. + * Get the gcmCredential property: Description of a NotificationHub GcmCredential. * * @return the gcmCredential value. */ @@ -254,7 +201,7 @@ public GcmCredential gcmCredential() { } /** - * Set the gcmCredential property: The GcmCredential of the created NotificationHub. + * Set the gcmCredential property: Description of a NotificationHub GcmCredential. * * @param gcmCredential the gcmCredential value to set. * @return the NotificationHubPatchParameters object itself. @@ -268,7 +215,7 @@ public NotificationHubPatchParameters withGcmCredential(GcmCredential gcmCredent } /** - * Get the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Get the mpnsCredential property: Description of a NotificationHub MpnsCredential. * * @return the mpnsCredential value. */ @@ -277,7 +224,7 @@ public MpnsCredential mpnsCredential() { } /** - * Set the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Set the mpnsCredential property: Description of a NotificationHub MpnsCredential. * * @param mpnsCredential the mpnsCredential value to set. * @return the NotificationHubPatchParameters object itself. @@ -291,7 +238,7 @@ public NotificationHubPatchParameters withMpnsCredential(MpnsCredential mpnsCred } /** - * Get the admCredential property: The AdmCredential of the created NotificationHub. + * Get the admCredential property: Description of a NotificationHub AdmCredential. * * @return the admCredential value. */ @@ -300,7 +247,7 @@ public AdmCredential admCredential() { } /** - * Set the admCredential property: The AdmCredential of the created NotificationHub. + * Set the admCredential property: Description of a NotificationHub AdmCredential. * * @param admCredential the admCredential value to set. * @return the NotificationHubPatchParameters object itself. @@ -314,7 +261,7 @@ public NotificationHubPatchParameters withAdmCredential(AdmCredential admCredent } /** - * Get the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Get the baiduCredential property: Description of a NotificationHub BaiduCredential. * * @return the baiduCredential value. */ @@ -323,7 +270,7 @@ public BaiduCredential baiduCredential() { } /** - * Set the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Set the baiduCredential property: Description of a NotificationHub BaiduCredential. * * @param baiduCredential the baiduCredential value to set. * @return the NotificationHubPatchParameters object itself. @@ -336,6 +283,84 @@ public NotificationHubPatchParameters withBaiduCredential(BaiduCredential baiduC return this; } + /** + * Get the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @return the browserCredential value. + */ + public BrowserCredential browserCredential() { + return this.innerProperties() == null ? null : this.innerProperties().browserCredential(); + } + + /** + * Set the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @param browserCredential the browserCredential value to set. + * @return the NotificationHubPatchParameters object itself. + */ + public NotificationHubPatchParameters withBrowserCredential(BrowserCredential browserCredential) { + if (this.innerProperties() == null) { + this.innerProperties = new NotificationHubProperties(); + } + this.innerProperties().withBrowserCredential(browserCredential); + return this; + } + + /** + * Get the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. + * + * @return the xiaomiCredential value. + */ + public XiaomiCredential xiaomiCredential() { + return this.innerProperties() == null ? null : this.innerProperties().xiaomiCredential(); + } + + /** + * Set the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. + * + * @param xiaomiCredential the xiaomiCredential value to set. + * @return the NotificationHubPatchParameters object itself. + */ + public NotificationHubPatchParameters withXiaomiCredential(XiaomiCredential xiaomiCredential) { + if (this.innerProperties() == null) { + this.innerProperties = new NotificationHubProperties(); + } + this.innerProperties().withXiaomiCredential(xiaomiCredential); + return this; + } + + /** + * Get the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @return the fcmV1Credential value. + */ + public FcmV1Credential fcmV1Credential() { + return this.innerProperties() == null ? null : this.innerProperties().fcmV1Credential(); + } + + /** + * Set the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @param fcmV1Credential the fcmV1Credential value to set. + * @return the NotificationHubPatchParameters object itself. + */ + public NotificationHubPatchParameters withFcmV1Credential(FcmV1Credential fcmV1Credential) { + if (this.innerProperties() == null) { + this.innerProperties = new NotificationHubProperties(); + } + this.innerProperties().withFcmV1Credential(fcmV1Credential); + return this; + } + + /** + * Get the dailyMaxActiveDevices property: The dailyMaxActiveDevices property. + * + * @return the dailyMaxActiveDevices value. + */ + public Long dailyMaxActiveDevices() { + return this.innerProperties() == null ? null : this.innerProperties().dailyMaxActiveDevices(); + } + /** * Validates the instance. * @@ -356,10 +381,9 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); jsonWriter.writeJsonField("properties", this.innerProperties); jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); return jsonWriter.writeEndObject(); } @@ -369,7 +393,6 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of NotificationHubPatchParameters if the JsonReader was pointing to an instance of it, or * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the NotificationHubPatchParameters. */ public static NotificationHubPatchParameters fromJson(JsonReader jsonReader) throws IOException { @@ -380,22 +403,14 @@ public static NotificationHubPatchParameters fromJson(JsonReader jsonReader) thr String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { - deserializedNotificationHubPatchParameters.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedNotificationHubPatchParameters.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedNotificationHubPatchParameters.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedNotificationHubPatchParameters.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedNotificationHubPatchParameters.withTags(tags); - } else if ("properties".equals(fieldName)) { + if ("properties".equals(fieldName)) { deserializedNotificationHubPatchParameters.innerProperties = NotificationHubProperties.fromJson(reader); } else if ("sku".equals(fieldName)) { deserializedNotificationHubPatchParameters.sku = Sku.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedNotificationHubPatchParameters.tags = tags; } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubResource.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubResource.java index 814345228f80..d58302627a53 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubResource.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubResource.java @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.notificationhubs.fluent.models.NotificationHubResourceInner; import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; @@ -52,75 +53,110 @@ public interface NotificationHubResource { Map tags(); /** - * Gets the sku property: The sku of the created namespace. + * Gets the sku property: The Sku description for a namespace. * * @return the sku value. */ Sku sku(); /** - * Gets the namePropertiesName property: The NotificationHub name. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the namePropertiesName property: Gets or sets the NotificationHub name. * * @return the namePropertiesName value. */ String namePropertiesName(); /** - * Gets the registrationTtl property: The RegistrationTtl of the created NotificationHub. + * Gets the registrationTtl property: Gets or sets the RegistrationTtl of the created NotificationHub. * * @return the registrationTtl value. */ String registrationTtl(); /** - * Gets the authorizationRules property: The AuthorizationRules of the created NotificationHub. + * Gets the authorizationRules property: Gets or sets the AuthorizationRules of the created NotificationHub. * * @return the authorizationRules value. */ List authorizationRules(); /** - * Gets the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Gets the apnsCredential property: Description of a NotificationHub ApnsCredential. * * @return the apnsCredential value. */ ApnsCredential apnsCredential(); /** - * Gets the wnsCredential property: The WnsCredential of the created NotificationHub. + * Gets the wnsCredential property: Description of a NotificationHub WnsCredential. * * @return the wnsCredential value. */ WnsCredential wnsCredential(); /** - * Gets the gcmCredential property: The GcmCredential of the created NotificationHub. + * Gets the gcmCredential property: Description of a NotificationHub GcmCredential. * * @return the gcmCredential value. */ GcmCredential gcmCredential(); /** - * Gets the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Gets the mpnsCredential property: Description of a NotificationHub MpnsCredential. * * @return the mpnsCredential value. */ MpnsCredential mpnsCredential(); /** - * Gets the admCredential property: The AdmCredential of the created NotificationHub. + * Gets the admCredential property: Description of a NotificationHub AdmCredential. * * @return the admCredential value. */ AdmCredential admCredential(); /** - * Gets the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Gets the baiduCredential property: Description of a NotificationHub BaiduCredential. * * @return the baiduCredential value. */ BaiduCredential baiduCredential(); + /** + * Gets the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @return the browserCredential value. + */ + BrowserCredential browserCredential(); + + /** + * Gets the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. + * + * @return the xiaomiCredential value. + */ + XiaomiCredential xiaomiCredential(); + + /** + * Gets the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @return the fcmV1Credential value. + */ + FcmV1Credential fcmV1Credential(); + + /** + * Gets the dailyMaxActiveDevices property: The dailyMaxActiveDevices property. + * + * @return the dailyMaxActiveDevices value. + */ + Long dailyMaxActiveDevices(); + /** * Gets the region of the resource. * @@ -194,8 +230,8 @@ interface WithParentResource { /** * Specifies resourceGroupName, namespaceName. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. * @return the next definition stage. */ WithCreate withExistingNamespace(String resourceGroupName, String namespaceName); @@ -207,9 +243,10 @@ interface WithParentResource { */ interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithSku, DefinitionStages.WithNamePropertiesName, DefinitionStages.WithRegistrationTtl, - DefinitionStages.WithAuthorizationRules, DefinitionStages.WithApnsCredential, - DefinitionStages.WithWnsCredential, DefinitionStages.WithGcmCredential, DefinitionStages.WithMpnsCredential, - DefinitionStages.WithAdmCredential, DefinitionStages.WithBaiduCredential { + DefinitionStages.WithApnsCredential, DefinitionStages.WithWnsCredential, DefinitionStages.WithGcmCredential, + DefinitionStages.WithMpnsCredential, DefinitionStages.WithAdmCredential, + DefinitionStages.WithBaiduCredential, DefinitionStages.WithBrowserCredential, + DefinitionStages.WithXiaomiCredential, DefinitionStages.WithFcmV1Credential { /** * Executes the create request. * @@ -244,9 +281,9 @@ interface WithTags { */ interface WithSku { /** - * Specifies the sku property: The sku of the created namespace. + * Specifies the sku property: The Sku description for a namespace. * - * @param sku The sku of the created namespace. + * @param sku The Sku description for a namespace. * @return the next definition stage. */ WithCreate withSku(Sku sku); @@ -257,9 +294,9 @@ interface WithSku { */ interface WithNamePropertiesName { /** - * Specifies the namePropertiesName property: The NotificationHub name.. + * Specifies the namePropertiesName property: Gets or sets the NotificationHub name.. * - * @param namePropertiesName The NotificationHub name. + * @param namePropertiesName Gets or sets the NotificationHub name. * @return the next definition stage. */ WithCreate withNamePropertiesName(String namePropertiesName); @@ -270,35 +307,22 @@ interface WithNamePropertiesName { */ interface WithRegistrationTtl { /** - * Specifies the registrationTtl property: The RegistrationTtl of the created NotificationHub. + * Specifies the registrationTtl property: Gets or sets the RegistrationTtl of the created NotificationHub. * - * @param registrationTtl The RegistrationTtl of the created NotificationHub. + * @param registrationTtl Gets or sets the RegistrationTtl of the created NotificationHub. * @return the next definition stage. */ WithCreate withRegistrationTtl(String registrationTtl); } - /** - * The stage of the NotificationHubResource definition allowing to specify authorizationRules. - */ - interface WithAuthorizationRules { - /** - * Specifies the authorizationRules property: The AuthorizationRules of the created NotificationHub. - * - * @param authorizationRules The AuthorizationRules of the created NotificationHub. - * @return the next definition stage. - */ - WithCreate withAuthorizationRules(List authorizationRules); - } - /** * The stage of the NotificationHubResource definition allowing to specify apnsCredential. */ interface WithApnsCredential { /** - * Specifies the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Specifies the apnsCredential property: Description of a NotificationHub ApnsCredential.. * - * @param apnsCredential The ApnsCredential of the created NotificationHub. + * @param apnsCredential Description of a NotificationHub ApnsCredential. * @return the next definition stage. */ WithCreate withApnsCredential(ApnsCredential apnsCredential); @@ -309,9 +333,9 @@ interface WithApnsCredential { */ interface WithWnsCredential { /** - * Specifies the wnsCredential property: The WnsCredential of the created NotificationHub. + * Specifies the wnsCredential property: Description of a NotificationHub WnsCredential.. * - * @param wnsCredential The WnsCredential of the created NotificationHub. + * @param wnsCredential Description of a NotificationHub WnsCredential. * @return the next definition stage. */ WithCreate withWnsCredential(WnsCredential wnsCredential); @@ -322,9 +346,9 @@ interface WithWnsCredential { */ interface WithGcmCredential { /** - * Specifies the gcmCredential property: The GcmCredential of the created NotificationHub. + * Specifies the gcmCredential property: Description of a NotificationHub GcmCredential.. * - * @param gcmCredential The GcmCredential of the created NotificationHub. + * @param gcmCredential Description of a NotificationHub GcmCredential. * @return the next definition stage. */ WithCreate withGcmCredential(GcmCredential gcmCredential); @@ -335,9 +359,9 @@ interface WithGcmCredential { */ interface WithMpnsCredential { /** - * Specifies the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Specifies the mpnsCredential property: Description of a NotificationHub MpnsCredential.. * - * @param mpnsCredential The MpnsCredential of the created NotificationHub. + * @param mpnsCredential Description of a NotificationHub MpnsCredential. * @return the next definition stage. */ WithCreate withMpnsCredential(MpnsCredential mpnsCredential); @@ -348,9 +372,9 @@ interface WithMpnsCredential { */ interface WithAdmCredential { /** - * Specifies the admCredential property: The AdmCredential of the created NotificationHub. + * Specifies the admCredential property: Description of a NotificationHub AdmCredential.. * - * @param admCredential The AdmCredential of the created NotificationHub. + * @param admCredential Description of a NotificationHub AdmCredential. * @return the next definition stage. */ WithCreate withAdmCredential(AdmCredential admCredential); @@ -361,13 +385,52 @@ interface WithAdmCredential { */ interface WithBaiduCredential { /** - * Specifies the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Specifies the baiduCredential property: Description of a NotificationHub BaiduCredential.. * - * @param baiduCredential The BaiduCredential of the created NotificationHub. + * @param baiduCredential Description of a NotificationHub BaiduCredential. * @return the next definition stage. */ WithCreate withBaiduCredential(BaiduCredential baiduCredential); } + + /** + * The stage of the NotificationHubResource definition allowing to specify browserCredential. + */ + interface WithBrowserCredential { + /** + * Specifies the browserCredential property: Description of a NotificationHub BrowserCredential.. + * + * @param browserCredential Description of a NotificationHub BrowserCredential. + * @return the next definition stage. + */ + WithCreate withBrowserCredential(BrowserCredential browserCredential); + } + + /** + * The stage of the NotificationHubResource definition allowing to specify xiaomiCredential. + */ + interface WithXiaomiCredential { + /** + * Specifies the xiaomiCredential property: Description of a NotificationHub XiaomiCredential.. + * + * @param xiaomiCredential Description of a NotificationHub XiaomiCredential. + * @return the next definition stage. + */ + WithCreate withXiaomiCredential(XiaomiCredential xiaomiCredential); + } + + /** + * The stage of the NotificationHubResource definition allowing to specify fcmV1Credential. + */ + interface WithFcmV1Credential { + /** + * Specifies the fcmV1Credential property: Description of a NotificationHub FcmV1Credential.. + * + * @param fcmV1Credential Description of a NotificationHub FcmV1Credential. + * @return the next definition stage. + */ + WithCreate withFcmV1Credential(FcmV1Credential fcmV1Credential); + } } /** @@ -380,10 +443,10 @@ interface WithBaiduCredential { /** * The template for NotificationHubResource update. */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithSku, UpdateStages.WithNamePropertiesName, - UpdateStages.WithRegistrationTtl, UpdateStages.WithAuthorizationRules, UpdateStages.WithApnsCredential, - UpdateStages.WithWnsCredential, UpdateStages.WithGcmCredential, UpdateStages.WithMpnsCredential, - UpdateStages.WithAdmCredential, UpdateStages.WithBaiduCredential { + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku, UpdateStages.WithRegistrationTtl, + UpdateStages.WithApnsCredential, UpdateStages.WithWnsCredential, UpdateStages.WithGcmCredential, + UpdateStages.WithMpnsCredential, UpdateStages.WithAdmCredential, UpdateStages.WithBaiduCredential, + UpdateStages.WithBrowserCredential, UpdateStages.WithXiaomiCredential, UpdateStages.WithFcmV1Credential { /** * Executes the update request. * @@ -409,9 +472,9 @@ interface UpdateStages { */ interface WithTags { /** - * Specifies the tags property: Resource tags.. + * Specifies the tags property: Dictionary of <string>. * - * @param tags Resource tags. + * @param tags Dictionary of <string>. * @return the next definition stage. */ Update withTags(Map tags); @@ -422,61 +485,35 @@ interface WithTags { */ interface WithSku { /** - * Specifies the sku property: The sku of the created namespace. + * Specifies the sku property: The Sku description for a namespace. * - * @param sku The sku of the created namespace. + * @param sku The Sku description for a namespace. * @return the next definition stage. */ Update withSku(Sku sku); } - /** - * The stage of the NotificationHubResource update allowing to specify namePropertiesName. - */ - interface WithNamePropertiesName { - /** - * Specifies the namePropertiesName property: The NotificationHub name.. - * - * @param namePropertiesName The NotificationHub name. - * @return the next definition stage. - */ - Update withNamePropertiesName(String namePropertiesName); - } - /** * The stage of the NotificationHubResource update allowing to specify registrationTtl. */ interface WithRegistrationTtl { /** - * Specifies the registrationTtl property: The RegistrationTtl of the created NotificationHub. + * Specifies the registrationTtl property: Gets or sets the RegistrationTtl of the created NotificationHub. * - * @param registrationTtl The RegistrationTtl of the created NotificationHub. + * @param registrationTtl Gets or sets the RegistrationTtl of the created NotificationHub. * @return the next definition stage. */ Update withRegistrationTtl(String registrationTtl); } - /** - * The stage of the NotificationHubResource update allowing to specify authorizationRules. - */ - interface WithAuthorizationRules { - /** - * Specifies the authorizationRules property: The AuthorizationRules of the created NotificationHub. - * - * @param authorizationRules The AuthorizationRules of the created NotificationHub. - * @return the next definition stage. - */ - Update withAuthorizationRules(List authorizationRules); - } - /** * The stage of the NotificationHubResource update allowing to specify apnsCredential. */ interface WithApnsCredential { /** - * Specifies the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Specifies the apnsCredential property: Description of a NotificationHub ApnsCredential.. * - * @param apnsCredential The ApnsCredential of the created NotificationHub. + * @param apnsCredential Description of a NotificationHub ApnsCredential. * @return the next definition stage. */ Update withApnsCredential(ApnsCredential apnsCredential); @@ -487,9 +524,9 @@ interface WithApnsCredential { */ interface WithWnsCredential { /** - * Specifies the wnsCredential property: The WnsCredential of the created NotificationHub. + * Specifies the wnsCredential property: Description of a NotificationHub WnsCredential.. * - * @param wnsCredential The WnsCredential of the created NotificationHub. + * @param wnsCredential Description of a NotificationHub WnsCredential. * @return the next definition stage. */ Update withWnsCredential(WnsCredential wnsCredential); @@ -500,9 +537,9 @@ interface WithWnsCredential { */ interface WithGcmCredential { /** - * Specifies the gcmCredential property: The GcmCredential of the created NotificationHub. + * Specifies the gcmCredential property: Description of a NotificationHub GcmCredential.. * - * @param gcmCredential The GcmCredential of the created NotificationHub. + * @param gcmCredential Description of a NotificationHub GcmCredential. * @return the next definition stage. */ Update withGcmCredential(GcmCredential gcmCredential); @@ -513,9 +550,9 @@ interface WithGcmCredential { */ interface WithMpnsCredential { /** - * Specifies the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Specifies the mpnsCredential property: Description of a NotificationHub MpnsCredential.. * - * @param mpnsCredential The MpnsCredential of the created NotificationHub. + * @param mpnsCredential Description of a NotificationHub MpnsCredential. * @return the next definition stage. */ Update withMpnsCredential(MpnsCredential mpnsCredential); @@ -526,9 +563,9 @@ interface WithMpnsCredential { */ interface WithAdmCredential { /** - * Specifies the admCredential property: The AdmCredential of the created NotificationHub. + * Specifies the admCredential property: Description of a NotificationHub AdmCredential.. * - * @param admCredential The AdmCredential of the created NotificationHub. + * @param admCredential Description of a NotificationHub AdmCredential. * @return the next definition stage. */ Update withAdmCredential(AdmCredential admCredential); @@ -539,13 +576,52 @@ interface WithAdmCredential { */ interface WithBaiduCredential { /** - * Specifies the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Specifies the baiduCredential property: Description of a NotificationHub BaiduCredential.. * - * @param baiduCredential The BaiduCredential of the created NotificationHub. + * @param baiduCredential Description of a NotificationHub BaiduCredential. * @return the next definition stage. */ Update withBaiduCredential(BaiduCredential baiduCredential); } + + /** + * The stage of the NotificationHubResource update allowing to specify browserCredential. + */ + interface WithBrowserCredential { + /** + * Specifies the browserCredential property: Description of a NotificationHub BrowserCredential.. + * + * @param browserCredential Description of a NotificationHub BrowserCredential. + * @return the next definition stage. + */ + Update withBrowserCredential(BrowserCredential browserCredential); + } + + /** + * The stage of the NotificationHubResource update allowing to specify xiaomiCredential. + */ + interface WithXiaomiCredential { + /** + * Specifies the xiaomiCredential property: Description of a NotificationHub XiaomiCredential.. + * + * @param xiaomiCredential Description of a NotificationHub XiaomiCredential. + * @return the next definition stage. + */ + Update withXiaomiCredential(XiaomiCredential xiaomiCredential); + } + + /** + * The stage of the NotificationHubResource update allowing to specify fcmV1Credential. + */ + interface WithFcmV1Credential { + /** + * Specifies the fcmV1Credential property: Description of a NotificationHub FcmV1Credential.. + * + * @param fcmV1Credential Description of a NotificationHub FcmV1Credential. + * @return the next definition stage. + */ + Update withFcmV1Credential(FcmV1Credential fcmV1Credential); + } } /** @@ -564,19 +640,18 @@ interface WithBaiduCredential { NotificationHubResource refresh(Context context); /** - * test send a push notification. + * Test send a push notification. * - * @param parameters Debug send parameters. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of a NotificationHub Resource along with {@link Response}. */ - Response debugSendWithResponse(Object parameters, Context context); + Response debugSendWithResponse(Context context); /** - * test send a push notification. + * Test send a push notification. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -585,7 +660,7 @@ interface WithBaiduCredential { DebugSendResponse debugSend(); /** - * Lists the PNS Credentials associated with a notification hub . + * Lists the PNS Credentials associated with a notification hub. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -596,7 +671,7 @@ interface WithBaiduCredential { Response getPnsCredentialsWithResponse(Context context); /** - * Lists the PNS Credentials associated with a notification hub . + * Lists the PNS Credentials associated with a notification hub. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubResources.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubResources.java new file mode 100644 index 000000000000..381ffb1a6d42 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubResources.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of NotificationHubResources. + */ +public interface NotificationHubResources { + /** + * Gets the notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context); + + /** + * Gets the notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub. + */ + NotificationHubResource get(String resourceGroupName, String namespaceName, String notificationHubName); + + /** + * Deletes a notification hub associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String namespaceName, String notificationHubName, + Context context); + + /** + * Deletes a notification hub associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String namespaceName, String notificationHubName); + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String namespaceName); + + /** + * Lists the notification hubs associated with a namespace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param skipToken Continuation token. + * @param top Page size. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of NotificationHubResource items as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String namespaceName, String skipToken, + Integer top, Context context); + + /** + * Test send a push notification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub Resource along with {@link Response}. + */ + Response debugSendWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context); + + /** + * Test send a push notification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub Resource. + */ + DebugSendResponse debugSend(String resourceGroupName, String namespaceName, String notificationHubName); + + /** + * Lists the PNS Credentials associated with a notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials along with {@link Response}. + */ + Response getPnsCredentialsWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, Context context); + + /** + * Lists the PNS Credentials associated with a notification hub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param notificationHubName Notification Hub name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of a NotificationHub PNS Credentials. + */ + PnsCredentialsResource getPnsCredentials(String resourceGroupName, String namespaceName, + String notificationHubName); + + /** + * Gets the notification hub. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub along with {@link Response}. + */ + NotificationHubResource getById(String id); + + /** + * Gets the notification hub. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notification hub along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a notification hub associated with a namespace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a notification hub associated with a namespace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NotificationHubResource resource. + * + * @param name resource name. + * @return the first stage of the new NotificationHubResource definition. + */ + NotificationHubResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubs.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubs.java deleted file mode 100644 index d2b2b9fb5d8d..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/NotificationHubs.java +++ /dev/null @@ -1,423 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of NotificationHubs. - */ -public interface NotificationHubs { - /** - * Checks the availability of the given notificationHub in a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters The notificationHub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource along with {@link Response}. - */ - Response checkNotificationHubAvailabilityWithResponse(String resourceGroupName, - String namespaceName, CheckAvailabilityParameters parameters, Context context); - - /** - * Checks the availability of the given notificationHub in a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param parameters The notificationHub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a CheckAvailability resource. - */ - CheckAvailabilityResult checkNotificationHubAvailability(String resourceGroupName, String namespaceName, - CheckAvailabilityParameters parameters); - - /** - * Deletes a notification hub associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteWithResponse(String resourceGroupName, String namespaceName, String notificationHubName, - Context context); - - /** - * Deletes a notification hub associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String namespaceName, String notificationHubName); - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. - */ - Response getWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Context context); - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. - */ - NotificationHubResource get(String resourceGroupName, String namespaceName, String notificationHubName); - - /** - * test send a push notification. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param parameters Debug send parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. - */ - Response debugSendWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Object parameters, Context context); - - /** - * test send a push notification. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource. - */ - DebugSendResponse debugSend(String resourceGroupName, String namespaceName, String notificationHubName); - - /** - * Creates/Updates an authorization rule for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules along with {@link Response}. - */ - Response createOrUpdateAuthorizationRuleWithResponse( - String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, Context context); - - /** - * Creates/Updates an authorization rule for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param parameters The shared access authorization rule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a Namespace AuthorizationRules. - */ - SharedAccessAuthorizationRuleResource createOrUpdateAuthorizationRule(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, - SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters); - - /** - * Deletes a notificationHub authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteAuthorizationRuleWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, Context context); - - /** - * Deletes a notificationHub authorization rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName Authorization Rule Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, - String authorizationRuleName); - - /** - * Gets an authorization rule for a NotificationHub by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName authorization rule name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a NotificationHub by name along with {@link Response}. - */ - Response getAuthorizationRuleWithResponse(String resourceGroupName, - String namespaceName, String notificationHubName, String authorizationRuleName, Context context); - - /** - * Gets an authorization rule for a NotificationHub by name. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName authorization rule name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an authorization rule for a NotificationHub by name. - */ - SharedAccessAuthorizationRuleResource getAuthorizationRule(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName); - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation as paginated response with {@link PagedIterable}. - */ - PagedIterable list(String resourceGroupName, String namespaceName); - - /** - * Lists the notification hubs associated with a namespace. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of the List NotificationHub operation as paginated response with {@link PagedIterable}. - */ - PagedIterable list(String resourceGroupName, String namespaceName, Context context); - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. - */ - PagedIterable listAuthorizationRules(String resourceGroupName, - String namespaceName, String notificationHubName); - - /** - * Gets the authorization rules for a NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. - */ - PagedIterable listAuthorizationRules(String resourceGroupName, - String namespaceName, String notificationHubName, Context context); - - /** - * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response}. - */ - Response listKeysWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, Context context); - - /** - * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the NotificationHub. - */ - ResourceListKeys listKeys(String resourceGroupName, String namespaceName, String notificationHubName, - String authorizationRuleName); - - /** - * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response}. - */ - Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, String authorizationRuleName, PolicykeyResource parameters, Context context); - - /** - * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule. - * @param parameters Parameters supplied to regenerate the NotificationHub Authorization Rule Key. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String. - */ - ResourceListKeys regenerateKeys(String resourceGroupName, String namespaceName, String notificationHubName, - String authorizationRuleName, PolicykeyResource parameters); - - /** - * Lists the PNS Credentials associated with a notification hub . - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub PNS Credentials along with {@link Response}. - */ - Response getPnsCredentialsWithResponse(String resourceGroupName, String namespaceName, - String notificationHubName, Context context); - - /** - * Lists the PNS Credentials associated with a notification hub . - * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. - * @param notificationHubName The notification hub name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub PNS Credentials. - */ - PnsCredentialsResource getPnsCredentials(String resourceGroupName, String namespaceName, - String notificationHubName); - - /** - * Lists the notification hubs associated with a namespace. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. - */ - NotificationHubResource getById(String id); - - /** - * Lists the notification hubs associated with a namespace. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return description of a NotificationHub Resource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Deletes a notification hub associated with a namespace. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Deletes a notification hub associated with a namespace. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new NotificationHubResource resource. - * - * @param name resource name. - * @return the first stage of the new NotificationHubResource definition. - */ - NotificationHubResource.DefinitionStages.Blank define(String name); -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Operation.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Operation.java index fbd2295f38f0..e46adf7fdcad 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Operation.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Operation.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; @@ -11,19 +11,33 @@ */ public interface Operation { /** - * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * Gets the name property: The name of the operation being performed on this particular object.". * * @return the name value. */ String name(); /** - * Gets the display property: The object that represents the operation. + * Gets the display property: he localized display information for this particular operation / action. * * @return the display value. */ OperationDisplay display(); + /** + * Gets the isDataAction property: The intended executor of the operation.". + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + OperationProperties properties(); + /** * Gets the inner com.azure.resourcemanager.notificationhubs.fluent.models.OperationInner object. * diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationDisplay.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationDisplay.java index 4e30604332c1..16807b8fbd8a 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationDisplay.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationDisplay.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; @@ -12,33 +12,42 @@ import java.io.IOException; /** - * The object that represents the operation. + * The OperationDisplay model. */ @Immutable public final class OperationDisplay implements JsonSerializable { /* - * Service provider: Microsoft.NotificationHubs + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". */ private String provider; /* - * Resource on which the operation is performed: Invoice, etc. + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". */ private String resource; /* - * Operation type: Read, write, delete, etc. + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". */ private String operation; + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + /** * Creates an instance of OperationDisplay class. */ - public OperationDisplay() { + private OperationDisplay() { } /** - * Get the provider property: Service provider: Microsoft.NotificationHubs. + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". * * @return the provider value. */ @@ -47,7 +56,8 @@ public String provider() { } /** - * Get the resource property: Resource on which the operation is performed: Invoice, etc. + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". * * @return the resource value. */ @@ -56,7 +66,8 @@ public String resource() { } /** - * Get the operation property: Operation type: Read, write, delete, etc. + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". * * @return the operation value. */ @@ -64,6 +75,16 @@ public String operation() { return this.operation; } + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + /** * Validates the instance. * @@ -102,6 +123,8 @@ public static OperationDisplay fromJson(JsonReader jsonReader) throws IOExceptio deserializedOperationDisplay.resource = reader.getString(); } else if ("operation".equals(fieldName)) { deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationProperties.java new file mode 100644 index 000000000000..d1c5cbd5015f --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Optional operation properties. + */ +@Immutable +public final class OperationProperties implements JsonSerializable { + /* + * Optional service specification used in Operations API. + */ + private ServiceSpecification serviceSpecification; + + /** + * Creates an instance of OperationProperties class. + */ + private OperationProperties() { + } + + /** + * Get the serviceSpecification property: Optional service specification used in Operations API. + * + * @return the serviceSpecification value. + */ + public ServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceSpecification() != null) { + serviceSpecification().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("serviceSpecification", this.serviceSpecification); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationProperties. + */ + public static OperationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationProperties deserializedOperationProperties = new OperationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceSpecification".equals(fieldName)) { + deserializedOperationProperties.serviceSpecification = ServiceSpecification.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationProperties; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationProvisioningState.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationProvisioningState.java new file mode 100644 index 000000000000..2603435f4266 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/OperationProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for OperationProvisioningState. + */ +public final class OperationProvisioningState extends ExpandableStringEnum { + /** + * Static value Unknown for OperationProvisioningState. + */ + public static final OperationProvisioningState UNKNOWN = fromString("Unknown"); + + /** + * Static value InProgress for OperationProvisioningState. + */ + public static final OperationProvisioningState IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Succeeded for OperationProvisioningState. + */ + public static final OperationProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for OperationProvisioningState. + */ + public static final OperationProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for OperationProvisioningState. + */ + public static final OperationProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Pending for OperationProvisioningState. + */ + public static final OperationProvisioningState PENDING = fromString("Pending"); + + /** + * Static value Disabled for OperationProvisioningState. + */ + public static final OperationProvisioningState DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of OperationProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperationProvisioningState() { + } + + /** + * Creates or finds a OperationProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationProvisioningState. + */ + public static OperationProvisioningState fromString(String name) { + return fromString(name, OperationProvisioningState.class); + } + + /** + * Gets known OperationProvisioningState values. + * + * @return known OperationProvisioningState values. + */ + public static Collection values() { + return values(OperationProvisioningState.class); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Operations.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Operations.java index e417e428ceab..62280eb2ecdc 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Operations.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Operations.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; @@ -12,24 +12,22 @@ */ public interface Operations { /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations as paginated response with - * {@link PagedIterable}. + * @return paged collection of Operation items as paginated response with {@link PagedIterable}. */ PagedIterable list(); /** - * Lists all of the available NotificationHubs REST API operations. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list NotificationHubs operations as paginated response with - * {@link PagedIterable}. + * @return paged collection of Operation items as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PnsCredentialsResource.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PnsCredentialsResource.java index e272877ca4c0..1e4218cc1042 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PnsCredentialsResource.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PnsCredentialsResource.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner; import java.util.Map; @@ -33,67 +34,88 @@ public interface PnsCredentialsResource { String type(); /** - * Gets the location property: The geo-location where the resource lives. + * Gets the location property: Deprecated - only for compatibility. * * @return the location value. */ String location(); /** - * Gets the tags property: Resource tags. + * Gets the tags property: Deprecated - only for compatibility. * * @return the tags value. */ Map tags(); /** - * Gets the sku property: The sku of the created namespace. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the sku value. + * @return the systemData value. */ - Sku sku(); + SystemData systemData(); /** - * Gets the apnsCredential property: The ApnsCredential of the created NotificationHub. + * Gets the admCredential property: Description of a NotificationHub AdmCredential. + * + * @return the admCredential value. + */ + AdmCredential admCredential(); + + /** + * Gets the apnsCredential property: Description of a NotificationHub ApnsCredential. * * @return the apnsCredential value. */ ApnsCredential apnsCredential(); /** - * Gets the wnsCredential property: The WnsCredential of the created NotificationHub. + * Gets the baiduCredential property: Description of a NotificationHub BaiduCredential. * - * @return the wnsCredential value. + * @return the baiduCredential value. */ - WnsCredential wnsCredential(); + BaiduCredential baiduCredential(); + + /** + * Gets the browserCredential property: Description of a NotificationHub BrowserCredential. + * + * @return the browserCredential value. + */ + BrowserCredential browserCredential(); /** - * Gets the gcmCredential property: The GcmCredential of the created NotificationHub. + * Gets the gcmCredential property: Description of a NotificationHub GcmCredential. * * @return the gcmCredential value. */ GcmCredential gcmCredential(); /** - * Gets the mpnsCredential property: The MpnsCredential of the created NotificationHub. + * Gets the mpnsCredential property: Description of a NotificationHub MpnsCredential. * * @return the mpnsCredential value. */ MpnsCredential mpnsCredential(); /** - * Gets the admCredential property: The AdmCredential of the created NotificationHub. + * Gets the wnsCredential property: Description of a NotificationHub WnsCredential. * - * @return the admCredential value. + * @return the wnsCredential value. */ - AdmCredential admCredential(); + WnsCredential wnsCredential(); /** - * Gets the baiduCredential property: The BaiduCredential of the created NotificationHub. + * Gets the xiaomiCredential property: Description of a NotificationHub XiaomiCredential. * - * @return the baiduCredential value. + * @return the xiaomiCredential value. */ - BaiduCredential baiduCredential(); + XiaomiCredential xiaomiCredential(); + + /** + * Gets the fcmV1Credential property: Description of a NotificationHub FcmV1Credential. + * + * @return the fcmV1Credential value. + */ + FcmV1Credential fcmV1Credential(); /** * Gets the inner com.azure.resourcemanager.notificationhubs.fluent.models.PnsCredentialsResourceInner object. diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PolicyKeyResource.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PolicyKeyResource.java new file mode 100644 index 000000000000..16d541bca949 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PolicyKeyResource.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Namespace / NotificationHub Regenerate Keys request. + */ +@Fluent +public final class PolicyKeyResource implements JsonSerializable { + /* + * Type of Shared Access Policy Key (primary or secondary). + */ + private PolicyKeyType policyKey; + + /** + * Creates an instance of PolicyKeyResource class. + */ + public PolicyKeyResource() { + } + + /** + * Get the policyKey property: Type of Shared Access Policy Key (primary or secondary). + * + * @return the policyKey value. + */ + public PolicyKeyType policyKey() { + return this.policyKey; + } + + /** + * Set the policyKey property: Type of Shared Access Policy Key (primary or secondary). + * + * @param policyKey the policyKey value to set. + * @return the PolicyKeyResource object itself. + */ + public PolicyKeyResource withPolicyKey(PolicyKeyType policyKey) { + this.policyKey = policyKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policyKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property policyKey in model PolicyKeyResource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PolicyKeyResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("policyKey", this.policyKey == null ? null : this.policyKey.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PolicyKeyResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PolicyKeyResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PolicyKeyResource. + */ + public static PolicyKeyResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PolicyKeyResource deserializedPolicyKeyResource = new PolicyKeyResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("policyKey".equals(fieldName)) { + deserializedPolicyKeyResource.policyKey = PolicyKeyType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPolicyKeyResource; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PolicyKeyType.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PolicyKeyType.java new file mode 100644 index 000000000000..41926960716d --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PolicyKeyType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of Shared Access Policy Key (primary or secondary). + */ +public final class PolicyKeyType extends ExpandableStringEnum { + /** + * Static value PrimaryKey for PolicyKeyType. + */ + public static final PolicyKeyType PRIMARY_KEY = fromString("PrimaryKey"); + + /** + * Static value SecondaryKey for PolicyKeyType. + */ + public static final PolicyKeyType SECONDARY_KEY = fromString("SecondaryKey"); + + /** + * Creates a new instance of PolicyKeyType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PolicyKeyType() { + } + + /** + * Creates or finds a PolicyKeyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PolicyKeyType. + */ + public static PolicyKeyType fromString(String name) { + return fromString(name, PolicyKeyType.class); + } + + /** + * Gets known PolicyKeyType values. + * + * @return known PolicyKeyType values. + */ + public static Collection values() { + return values(PolicyKeyType.class); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PolicykeyResource.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PolicykeyResource.java deleted file mode 100644 index 9bbe6f601f16..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PolicykeyResource.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Namespace/NotificationHub Regenerate Keys. - */ -@Fluent -public final class PolicykeyResource implements JsonSerializable { - /* - * Name of the key that has to be regenerated for the Namespace/Notification Hub Authorization Rule. The value can - * be Primary Key/Secondary Key. - */ - private String policyKey; - - /** - * Creates an instance of PolicykeyResource class. - */ - public PolicykeyResource() { - } - - /** - * Get the policyKey property: Name of the key that has to be regenerated for the Namespace/Notification Hub - * Authorization Rule. The value can be Primary Key/Secondary Key. - * - * @return the policyKey value. - */ - public String policyKey() { - return this.policyKey; - } - - /** - * Set the policyKey property: Name of the key that has to be regenerated for the Namespace/Notification Hub - * Authorization Rule. The value can be Primary Key/Secondary Key. - * - * @param policyKey the policyKey value to set. - * @return the PolicykeyResource object itself. - */ - public PolicykeyResource withPolicyKey(String policyKey) { - this.policyKey = policyKey; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("policyKey", this.policyKey); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PolicykeyResource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PolicykeyResource if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the PolicykeyResource. - */ - public static PolicykeyResource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - PolicykeyResource deserializedPolicykeyResource = new PolicykeyResource(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("policyKey".equals(fieldName)) { - deserializedPolicykeyResource.policyKey = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedPolicykeyResource; - }); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..e5f76da53d44 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Private Endpoint Connection properties. + */ +@Fluent +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * State of Private Endpoint Connection. + */ + private PrivateEndpointConnectionProvisioningState provisioningState; + + /* + * Represents a Private Endpoint that is connected to Notification Hubs namespace using Private Endpoint Connection. + */ + private RemotePrivateEndpointConnection privateEndpoint; + + /* + * List of group ids. For Notification Hubs, it always contains a single "namespace" element. + */ + private List groupIds; + + /* + * State of the Private Link Service connection. + */ + private RemotePrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the provisioningState property: State of Private Endpoint Connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: State of Private Endpoint Connection. + * + * @param provisioningState the provisioningState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties + withProvisioningState(PrivateEndpointConnectionProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the privateEndpoint property: Represents a Private Endpoint that is connected to Notification Hubs namespace + * using Private Endpoint Connection. + * + * @return the privateEndpoint value. + */ + public RemotePrivateEndpointConnection privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Represents a Private Endpoint that is connected to Notification Hubs namespace + * using Private Endpoint Connection. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(RemotePrivateEndpointConnection privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the groupIds property: List of group ids. For Notification Hubs, it always contains a single "namespace" + * element. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Get the privateLinkServiceConnectionState property: State of the Private Link Service connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public RemotePrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: State of the Private Link Service connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + RemotePrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionProperties. + */ + public static PrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionProperties deserializedPrivateEndpointConnectionProperties + = new PrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState + = PrivateEndpointConnectionProvisioningState.fromString(reader.getString()); + } else if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint + = RemotePrivateEndpointConnection.fromJson(reader); + } else if ("groupIds".equals(fieldName)) { + List groupIds = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateEndpointConnectionProperties.groupIds = groupIds; + } else if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = RemotePrivateLinkServiceConnectionState.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionProvisioningState.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 000000000000..fed2a2ae7537 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * State of Private Endpoint Connection. + */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** + * Static value Unknown for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState UNKNOWN = fromString("Unknown"); + + /** + * Static value Succeeded for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Creating for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** + * Static value Updating for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value UpdatingByProxy for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState UPDATING_BY_PROXY = fromString("UpdatingByProxy"); + + /** + * Static value Deleting for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value DeletingByProxy for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState DELETING_BY_PROXY = fromString("DeletingByProxy"); + + /** + * Static value Deleted for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState DELETED = fromString("Deleted"); + + /** + * Creates a new instance of PrivateEndpointConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointConnectionProvisioningState() { + } + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** + * Gets known PrivateEndpointConnectionProvisioningState values. + * + * @return known PrivateEndpointConnectionProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionResource.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionResource.java new file mode 100644 index 000000000000..5d9c87af1ddd --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionResource.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateEndpointConnectionResourceInner; + +/** + * An immutable client-side representation of PrivateEndpointConnectionResource. + */ +public interface PrivateEndpointConnectionResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Private Endpoint Connection properties. + * + * @return the properties value. + */ + PrivateEndpointConnectionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.notificationhubs.fluent.models.PrivateEndpointConnectionResourceInner + * object. + * + * @return the inner object. + */ + PrivateEndpointConnectionResourceInner innerModel(); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionResources.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionResources.java new file mode 100644 index 000000000000..fed7167f40f8 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateEndpointConnectionResources.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateEndpointConnectionResourceInner; + +/** + * Resource collection API of PrivateEndpointConnectionResources. + */ +public interface PrivateEndpointConnectionResources { + /** + * Returns a Private Endpoint Connection with a given name. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace + * along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, Context context); + + /** + * Returns a Private Endpoint Connection with a given name. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ + PrivateEndpointConnectionResource get(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName); + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ + PrivateEndpointConnectionResource update(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters); + + /** + * Approves or rejects Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param parameters Description of the Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. + */ + PrivateEndpointConnectionResource update(String resourceGroupName, String namespaceName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner parameters, Context context); + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String namespaceName, String privateEndpointConnectionName); + + /** + * Deletes the Private Endpoint Connection. + * This is a public API that can be called directly by Notification Hubs users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param privateEndpointConnectionName Private Endpoint Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String namespaceName, String privateEndpointConnectionName, Context context); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String namespaceName); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String namespaceName, + Context context); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkConnectionStatus.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkConnectionStatus.java new file mode 100644 index 000000000000..c66c3db22d79 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkConnectionStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * State of Private Link Connection. + */ +public final class PrivateLinkConnectionStatus extends ExpandableStringEnum { + /** + * Static value Disconnected for PrivateLinkConnectionStatus. + */ + public static final PrivateLinkConnectionStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Static value Pending for PrivateLinkConnectionStatus. + */ + public static final PrivateLinkConnectionStatus PENDING = fromString("Pending"); + + /** + * Static value Approved for PrivateLinkConnectionStatus. + */ + public static final PrivateLinkConnectionStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for PrivateLinkConnectionStatus. + */ + public static final PrivateLinkConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of PrivateLinkConnectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateLinkConnectionStatus() { + } + + /** + * Creates or finds a PrivateLinkConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkConnectionStatus. + */ + public static PrivateLinkConnectionStatus fromString(String name) { + return fromString(name, PrivateLinkConnectionStatus.class); + } + + /** + * Gets known PrivateLinkConnectionStatus values. + * + * @return known PrivateLinkConnectionStatus values. + */ + public static Collection values() { + return values(PrivateLinkConnectionStatus.class); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkResource.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkResource.java new file mode 100644 index 000000000000..1a8360989e9e --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.notificationhubs.fluent.models.PrivateLinkResourceInner; + +/** + * An immutable client-side representation of PrivateLinkResource. + */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Represents properties of Private Link Resource. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.notificationhubs.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkResourceProperties.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..0f97e73e506a --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkResourceProperties.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents properties of Private Link Resource. + */ +@Immutable +public final class PrivateLinkResourceProperties implements JsonSerializable { + /* + * A Group Id for Private Link. For Notification Hubs, it is always set to "namespace". + */ + private String groupId; + + /* + * Required members. For Notification Hubs, it's always a collection with a single "namespace" item. + */ + private List requiredMembers; + + /* + * Required DNS zone names. For Notification Hubs, it contains two CNames for Service Bus and Notification Hubs + * zones. + */ + private List requiredZoneNames; + + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + private PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: A Group Id for Private Link. For Notification Hubs, it is always set to "namespace". + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: Required members. For Notification Hubs, it's always a collection with a single + * "namespace" item. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: Required DNS zone names. For Notification Hubs, it contains two CNames for + * Service Bus and Notification Hubs zones. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkResourceProperties. + */ + public static PrivateLinkResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceProperties deserializedPrivateLinkResourceProperties + = new PrivateLinkResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groupId".equals(fieldName)) { + deserializedPrivateLinkResourceProperties.groupId = reader.getString(); + } else if ("requiredMembers".equals(fieldName)) { + List requiredMembers = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredMembers = requiredMembers; + } else if ("requiredZoneNames".equals(fieldName)) { + List requiredZoneNames = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredZoneNames = requiredZoneNames; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceProperties; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkResources.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkResources.java new file mode 100644 index 000000000000..02ef7fad0b5d --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PrivateLinkResources.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of PrivateLinkResources. + */ +public interface PrivateLinkResources { + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param subResourceName Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Private Link Arm Resource along with {@link Response}. + */ + Response getGroupIdWithResponse(String resourceGroupName, String namespaceName, + String subResourceName, Context context); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param subResourceName Name of the Private Link sub-resource. The only supported sub-resource is "namespace". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Private Link Arm Resource. + */ + PrivateLinkResource getGroupId(String resourceGroupName, String namespaceName, String subResourceName); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listGroupIds(String resourceGroupName, String namespaceName); + + /** + * 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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName Namespace name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listGroupIds(String resourceGroupName, String namespaceName, Context context); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PublicInternetAuthorizationRule.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PublicInternetAuthorizationRule.java new file mode 100644 index 000000000000..2196bdae1ad7 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PublicInternetAuthorizationRule.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A default (public Internet) network authorization rule, which contains rights if no other network rule matches. + */ +@Fluent +public final class PublicInternetAuthorizationRule implements JsonSerializable { + /* + * List of access rights. + */ + private List rights; + + /** + * Creates an instance of PublicInternetAuthorizationRule class. + */ + public PublicInternetAuthorizationRule() { + } + + /** + * Get the rights property: List of access rights. + * + * @return the rights value. + */ + public List rights() { + return this.rights; + } + + /** + * Set the rights property: List of access rights. + * + * @param rights the rights value to set. + * @return the PublicInternetAuthorizationRule object itself. + */ + public PublicInternetAuthorizationRule withRights(List rights) { + this.rights = rights; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (rights() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property rights in model PublicInternetAuthorizationRule")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PublicInternetAuthorizationRule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("rights", this.rights, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PublicInternetAuthorizationRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PublicInternetAuthorizationRule if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PublicInternetAuthorizationRule. + */ + public static PublicInternetAuthorizationRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PublicInternetAuthorizationRule deserializedPublicInternetAuthorizationRule + = new PublicInternetAuthorizationRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rights".equals(fieldName)) { + List rights + = reader.readArray(reader1 -> AccessRights.fromString(reader1.getString())); + deserializedPublicInternetAuthorizationRule.rights = rights; + } else { + reader.skipChildren(); + } + } + + return deserializedPublicInternetAuthorizationRule; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PublicNetworkAccess.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PublicNetworkAccess.java new file mode 100644 index 000000000000..4f662a9dd678 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/PublicNetworkAccess.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of public network access. + */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** + * Static value Enabled for PublicNetworkAccess. + */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** + * Static value Disabled for PublicNetworkAccess. + */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of PublicNetworkAccess value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicNetworkAccess() { + } + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** + * Gets known PublicNetworkAccess values. + * + * @return known PublicNetworkAccess values. + */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/RegistrationResult.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/RegistrationResult.java new file mode 100644 index 000000000000..fad68b0d13a0 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/RegistrationResult.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Notification result for a single registration. + */ +@Immutable +public final class RegistrationResult implements JsonSerializable { + /* + * PNS type. + */ + private String applicationPlatform; + + /* + * PNS handle. + */ + private String pnsHandle; + + /* + * Registration id. + */ + private String registrationId; + + /* + * Notification outcome. + */ + private String outcome; + + /** + * Creates an instance of RegistrationResult class. + */ + private RegistrationResult() { + } + + /** + * Get the applicationPlatform property: PNS type. + * + * @return the applicationPlatform value. + */ + public String applicationPlatform() { + return this.applicationPlatform; + } + + /** + * Get the pnsHandle property: PNS handle. + * + * @return the pnsHandle value. + */ + public String pnsHandle() { + return this.pnsHandle; + } + + /** + * Get the registrationId property: Registration id. + * + * @return the registrationId value. + */ + public String registrationId() { + return this.registrationId; + } + + /** + * Get the outcome property: Notification outcome. + * + * @return the outcome value. + */ + public String outcome() { + return this.outcome; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegistrationResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegistrationResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RegistrationResult. + */ + public static RegistrationResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegistrationResult deserializedRegistrationResult = new RegistrationResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("applicationPlatform".equals(fieldName)) { + deserializedRegistrationResult.applicationPlatform = reader.getString(); + } else if ("pnsHandle".equals(fieldName)) { + deserializedRegistrationResult.pnsHandle = reader.getString(); + } else if ("registrationId".equals(fieldName)) { + deserializedRegistrationResult.registrationId = reader.getString(); + } else if ("outcome".equals(fieldName)) { + deserializedRegistrationResult.outcome = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRegistrationResult; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/RemotePrivateEndpointConnection.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/RemotePrivateEndpointConnection.java new file mode 100644 index 000000000000..471f4f2933c6 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/RemotePrivateEndpointConnection.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a Private Endpoint that is connected to Notification Hubs namespace using Private Endpoint Connection. + */ +@Immutable +public final class RemotePrivateEndpointConnection implements JsonSerializable { + /* + * ARM resource ID of the Private Endpoint. This may belong to different subscription and resource group than a + * Notification Hubs namespace. + */ + private String id; + + /** + * Creates an instance of RemotePrivateEndpointConnection class. + */ + public RemotePrivateEndpointConnection() { + } + + /** + * Get the id property: ARM resource ID of the Private Endpoint. This may belong to different subscription and + * resource group than a Notification Hubs namespace. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RemotePrivateEndpointConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RemotePrivateEndpointConnection if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RemotePrivateEndpointConnection. + */ + public static RemotePrivateEndpointConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RemotePrivateEndpointConnection deserializedRemotePrivateEndpointConnection + = new RemotePrivateEndpointConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRemotePrivateEndpointConnection.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRemotePrivateEndpointConnection; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/RemotePrivateLinkServiceConnectionState.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/RemotePrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..de0c4af8197c --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/RemotePrivateLinkServiceConnectionState.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * State of the Private Link Service connection. + */ +@Fluent +public final class RemotePrivateLinkServiceConnectionState + implements JsonSerializable { + /* + * State of Private Link Connection. + */ + private PrivateLinkConnectionStatus status; + + /* + * Human-friendly description. + */ + private String description; + + /* + * Human-friendly description of required actions. + */ + private String actionsRequired; + + /** + * Creates an instance of RemotePrivateLinkServiceConnectionState class. + */ + public RemotePrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: State of Private Link Connection. + * + * @return the status value. + */ + public PrivateLinkConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: State of Private Link Connection. + * + * @param status the status value to set. + * @return the RemotePrivateLinkServiceConnectionState object itself. + */ + public RemotePrivateLinkServiceConnectionState withStatus(PrivateLinkConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: Human-friendly description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the actionsRequired property: Human-friendly description of required actions. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RemotePrivateLinkServiceConnectionState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RemotePrivateLinkServiceConnectionState if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RemotePrivateLinkServiceConnectionState. + */ + public static RemotePrivateLinkServiceConnectionState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RemotePrivateLinkServiceConnectionState deserializedRemotePrivateLinkServiceConnectionState + = new RemotePrivateLinkServiceConnectionState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedRemotePrivateLinkServiceConnectionState.status + = PrivateLinkConnectionStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedRemotePrivateLinkServiceConnectionState.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedRemotePrivateLinkServiceConnectionState.actionsRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRemotePrivateLinkServiceConnectionState; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ReplicationRegion.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ReplicationRegion.java new file mode 100644 index 000000000000..63e9bbd97e16 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ReplicationRegion.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Allowed replication region. + */ +public final class ReplicationRegion extends ExpandableStringEnum { + /** + * Static value Default for ReplicationRegion. + */ + public static final ReplicationRegion DEFAULT = fromString("Default"); + + /** + * Static value WestUs2 for ReplicationRegion. + */ + public static final ReplicationRegion WEST_US2 = fromString("WestUs2"); + + /** + * Static value NorthEurope for ReplicationRegion. + */ + public static final ReplicationRegion NORTH_EUROPE = fromString("NorthEurope"); + + /** + * Static value AustraliaEast for ReplicationRegion. + */ + public static final ReplicationRegion AUSTRALIA_EAST = fromString("AustraliaEast"); + + /** + * Static value BrazilSouth for ReplicationRegion. + */ + public static final ReplicationRegion BRAZIL_SOUTH = fromString("BrazilSouth"); + + /** + * Static value SouthEastAsia for ReplicationRegion. + */ + public static final ReplicationRegion SOUTH_EAST_ASIA = fromString("SouthEastAsia"); + + /** + * Static value SouthAfricaNorth for ReplicationRegion. + */ + public static final ReplicationRegion SOUTH_AFRICA_NORTH = fromString("SouthAfricaNorth"); + + /** + * Static value None for ReplicationRegion. + */ + public static final ReplicationRegion NONE = fromString("None"); + + /** + * Creates a new instance of ReplicationRegion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ReplicationRegion() { + } + + /** + * Creates or finds a ReplicationRegion from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationRegion. + */ + public static ReplicationRegion fromString(String name) { + return fromString(name, ReplicationRegion.class); + } + + /** + * Gets known ReplicationRegion values. + * + * @return known ReplicationRegion values. + */ + public static Collection values() { + return values(ReplicationRegion.class); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ResourceListKeys.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ResourceListKeys.java index aaf504af1a0f..1e4f3ebab20d 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ResourceListKeys.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ResourceListKeys.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; @@ -11,35 +11,36 @@ */ public interface ResourceListKeys { /** - * Gets the primaryConnectionString property: PrimaryConnectionString of the AuthorizationRule. + * Gets the primaryConnectionString property: Gets or sets primaryConnectionString of the AuthorizationRule. * * @return the primaryConnectionString value. */ String primaryConnectionString(); /** - * Gets the secondaryConnectionString property: SecondaryConnectionString of the created AuthorizationRule. + * Gets the secondaryConnectionString property: Gets or sets secondaryConnectionString of the created + * AuthorizationRule. * * @return the secondaryConnectionString value. */ String secondaryConnectionString(); /** - * Gets the primaryKey property: PrimaryKey of the created AuthorizationRule. + * Gets the primaryKey property: Gets or sets primaryKey of the created AuthorizationRule. * * @return the primaryKey value. */ String primaryKey(); /** - * Gets the secondaryKey property: SecondaryKey of the created AuthorizationRule. + * Gets the secondaryKey property: Gets or sets secondaryKey of the created AuthorizationRule. * * @return the secondaryKey value. */ String secondaryKey(); /** - * Gets the keyName property: KeyName of the created AuthorizationRule. + * Gets the keyName property: Gets or sets keyName of the created AuthorizationRule. * * @return the keyName value. */ diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ServiceSpecification.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ServiceSpecification.java new file mode 100644 index 000000000000..884b31075820 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ServiceSpecification.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Optional service specification used in Operations API. + */ +@Immutable +public final class ServiceSpecification implements JsonSerializable { + /* + * Log specifications. + */ + private List logSpecifications; + + /* + * Metric specification. + */ + private List metricSpecifications; + + /** + * Creates an instance of ServiceSpecification class. + */ + private ServiceSpecification() { + } + + /** + * Get the logSpecifications property: Log specifications. + * + * @return the logSpecifications value. + */ + public List logSpecifications() { + return this.logSpecifications; + } + + /** + * Get the metricSpecifications property: Metric specification. + * + * @return the metricSpecifications value. + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logSpecifications() != null) { + logSpecifications().forEach(e -> e.validate()); + } + if (metricSpecifications() != null) { + metricSpecifications().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceSpecification from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceSpecification if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServiceSpecification. + */ + public static ServiceSpecification fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceSpecification deserializedServiceSpecification = new ServiceSpecification(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logSpecifications".equals(fieldName)) { + List logSpecifications + = reader.readArray(reader1 -> LogSpecification.fromJson(reader1)); + deserializedServiceSpecification.logSpecifications = logSpecifications; + } else if ("metricSpecifications".equals(fieldName)) { + List metricSpecifications + = reader.readArray(reader1 -> MetricSpecification.fromJson(reader1)); + deserializedServiceSpecification.metricSpecifications = metricSpecifications; + } else { + reader.skipChildren(); + } + } + + return deserializedServiceSpecification; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleCreateOrUpdateParameters.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleCreateOrUpdateParameters.java deleted file mode 100644 index 556b81b6df7f..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleCreateOrUpdateParameters.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; -import java.io.IOException; - -/** - * Parameters supplied to the CreateOrUpdate Namespace AuthorizationRules. - */ -@Fluent -public final class SharedAccessAuthorizationRuleCreateOrUpdateParameters - implements JsonSerializable { - /* - * Properties of the Namespace AuthorizationRules. - */ - private SharedAccessAuthorizationRuleProperties properties; - - /** - * Creates an instance of SharedAccessAuthorizationRuleCreateOrUpdateParameters class. - */ - public SharedAccessAuthorizationRuleCreateOrUpdateParameters() { - } - - /** - * Get the properties property: Properties of the Namespace AuthorizationRules. - * - * @return the properties value. - */ - public SharedAccessAuthorizationRuleProperties properties() { - return this.properties; - } - - /** - * Set the properties property: Properties of the Namespace AuthorizationRules. - * - * @param properties the properties value to set. - * @return the SharedAccessAuthorizationRuleCreateOrUpdateParameters object itself. - */ - public SharedAccessAuthorizationRuleCreateOrUpdateParameters - withProperties(SharedAccessAuthorizationRuleProperties properties) { - this.properties = properties; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (properties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property properties in model SharedAccessAuthorizationRuleCreateOrUpdateParameters")); - } else { - properties().validate(); - } - } - - private static final ClientLogger LOGGER - = new ClientLogger(SharedAccessAuthorizationRuleCreateOrUpdateParameters.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SharedAccessAuthorizationRuleCreateOrUpdateParameters from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SharedAccessAuthorizationRuleCreateOrUpdateParameters if the JsonReader was pointing to an - * instance of it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SharedAccessAuthorizationRuleCreateOrUpdateParameters. - */ - public static SharedAccessAuthorizationRuleCreateOrUpdateParameters fromJson(JsonReader jsonReader) - throws IOException { - return jsonReader.readObject(reader -> { - SharedAccessAuthorizationRuleCreateOrUpdateParameters deserializedSharedAccessAuthorizationRuleCreateOrUpdateParameters - = new SharedAccessAuthorizationRuleCreateOrUpdateParameters(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("properties".equals(fieldName)) { - deserializedSharedAccessAuthorizationRuleCreateOrUpdateParameters.properties - = SharedAccessAuthorizationRuleProperties.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedSharedAccessAuthorizationRuleCreateOrUpdateParameters; - }); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleResource.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleResource.java index 34d0d7d4fa92..3f59c7eefb37 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleResource.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleResource.java @@ -1,14 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleResourceInner; +import java.time.OffsetDateTime; import java.util.List; import java.util.Map; @@ -38,84 +39,86 @@ public interface SharedAccessAuthorizationRuleResource { String type(); /** - * Gets the location property: The geo-location where the resource lives. + * Gets the location property: The location property. * * @return the location value. */ String location(); /** - * Gets the tags property: Resource tags. + * Gets the tags property: The tags property. * * @return the tags value. */ Map tags(); /** - * Gets the sku property: The sku of the created namespace. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the sku value. + * @return the systemData value. */ - Sku sku(); + SystemData systemData(); /** - * Gets the rights property: The rights associated with the rule. + * Gets the rights property: Gets or sets the rights associated with the rule. * * @return the rights value. */ List rights(); /** - * Gets the primaryKey property: A base64-encoded 256-bit primary key for signing and validating the SAS token. + * Gets the primaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. * * @return the primaryKey value. */ String primaryKey(); /** - * Gets the secondaryKey property: A base64-encoded 256-bit primary key for signing and validating the SAS token. + * Gets the secondaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. * * @return the secondaryKey value. */ String secondaryKey(); /** - * Gets the keyName property: A string that describes the authorization rule. + * Gets the keyName property: Gets a string that describes the authorization rule. * * @return the keyName value. */ String keyName(); /** - * Gets the claimType property: A string that describes the claim type. + * Gets the modifiedTime property: Gets the last modified time for this rule. * - * @return the claimType value. + * @return the modifiedTime value. */ - String claimType(); + OffsetDateTime modifiedTime(); /** - * Gets the claimValue property: A string that describes the claim value. + * Gets the createdTime property: Gets the created time for this rule. * - * @return the claimValue value. + * @return the createdTime value. */ - String claimValue(); + OffsetDateTime createdTime(); /** - * Gets the modifiedTime property: The last modified time for this rule. + * Gets the claimType property: Gets a string that describes the claim type. * - * @return the modifiedTime value. + * @return the claimType value. */ - String modifiedTime(); + String claimType(); /** - * Gets the createdTime property: The created time for this rule. + * Gets the claimValue property: Gets a string that describes the claim value. * - * @return the createdTime value. + * @return the claimValue value. */ - String createdTime(); + String claimValue(); /** - * Gets the revision property: The revision number for the rule. + * Gets the revision property: Gets the revision number for the rule. * * @return the revision value. */ @@ -153,8 +156,8 @@ public interface SharedAccessAuthorizationRuleResource { /** * The entirety of the SharedAccessAuthorizationRuleResource definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, - DefinitionStages.WithProperties, DefinitionStages.WithCreate { + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } /** @@ -172,33 +175,23 @@ interface Blank extends WithParentResource { */ interface WithParentResource { /** - * Specifies resourceGroupName, namespaceName. + * Specifies resourceGroupName, namespaceName, notificationHubName. * - * @param resourceGroupName The name of the resource group. - * @param namespaceName The namespace name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. * @return the next definition stage. */ - WithProperties withExistingNamespace(String resourceGroupName, String namespaceName); - } - - /** - * The stage of the SharedAccessAuthorizationRuleResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: Properties of the Namespace AuthorizationRules.. - * - * @param properties Properties of the Namespace AuthorizationRules. - * @return the next definition stage. - */ - WithCreate withProperties(SharedAccessAuthorizationRuleProperties properties); + WithCreate withExistingNotificationHub(String resourceGroupName, String namespaceName, + String notificationHubName); } /** * The stage of the SharedAccessAuthorizationRuleResource definition which contains all the minimum required * properties for the resource to be created, but also allows for any other optional properties to be specified. */ - interface WithCreate { + interface WithCreate extends DefinitionStages.WithLocation, DefinitionStages.WithTags, + DefinitionStages.WithRights, DefinitionStages.WithPrimaryKey, DefinitionStages.WithSecondaryKey { /** * Executes the create request. * @@ -214,6 +207,83 @@ interface WithCreate { */ SharedAccessAuthorizationRuleResource create(Context context); } + + /** + * The stage of the SharedAccessAuthorizationRuleResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The location property. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The location property. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + + /** + * The stage of the SharedAccessAuthorizationRuleResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: The tags property.. + * + * @param tags The tags property. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the SharedAccessAuthorizationRuleResource definition allowing to specify rights. + */ + interface WithRights { + /** + * Specifies the rights property: Gets or sets the rights associated with the rule.. + * + * @param rights Gets or sets the rights associated with the rule. + * @return the next definition stage. + */ + WithCreate withRights(List rights); + } + + /** + * The stage of the SharedAccessAuthorizationRuleResource definition allowing to specify primaryKey. + */ + interface WithPrimaryKey { + /** + * Specifies the primaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token.. + * + * @param primaryKey Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. + * @return the next definition stage. + */ + WithCreate withPrimaryKey(String primaryKey); + } + + /** + * The stage of the SharedAccessAuthorizationRuleResource definition allowing to specify secondaryKey. + */ + interface WithSecondaryKey { + /** + * Specifies the secondaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token.. + * + * @param secondaryKey Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. + * @return the next definition stage. + */ + WithCreate withSecondaryKey(String secondaryKey); + } } /** @@ -226,7 +296,8 @@ interface WithCreate { /** * The template for SharedAccessAuthorizationRuleResource update. */ - interface Update extends UpdateStages.WithProperties { + interface Update extends UpdateStages.WithTags, UpdateStages.WithRights, UpdateStages.WithPrimaryKey, + UpdateStages.WithSecondaryKey { /** * Executes the update request. * @@ -248,16 +319,59 @@ interface Update extends UpdateStages.WithProperties { */ interface UpdateStages { /** - * The stage of the SharedAccessAuthorizationRuleResource update allowing to specify properties. + * The stage of the SharedAccessAuthorizationRuleResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: The tags property.. + * + * @param tags The tags property. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SharedAccessAuthorizationRuleResource update allowing to specify rights. + */ + interface WithRights { + /** + * Specifies the rights property: Gets or sets the rights associated with the rule.. + * + * @param rights Gets or sets the rights associated with the rule. + * @return the next definition stage. + */ + Update withRights(List rights); + } + + /** + * The stage of the SharedAccessAuthorizationRuleResource update allowing to specify primaryKey. + */ + interface WithPrimaryKey { + /** + * Specifies the primaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token.. + * + * @param primaryKey Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. + * @return the next definition stage. + */ + Update withPrimaryKey(String primaryKey); + } + + /** + * The stage of the SharedAccessAuthorizationRuleResource update allowing to specify secondaryKey. */ - interface WithProperties { + interface WithSecondaryKey { /** - * Specifies the properties property: Properties of the Namespace AuthorizationRules.. + * Specifies the secondaryKey property: Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token.. * - * @param properties Properties of the Namespace AuthorizationRules. + * @param secondaryKey Gets a base64-encoded 256-bit primary key for signing and + * validating the SAS token. * @return the next definition stage. */ - Update withProperties(SharedAccessAuthorizationRuleProperties properties); + Update withSecondaryKey(String secondaryKey); } } @@ -277,45 +391,46 @@ interface WithProperties { SharedAccessAuthorizationRuleResource refresh(Context context); /** - * Gets the Primary and Secondary ConnectionStrings to the namespace. + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the namespace along with {@link Response}. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response}. */ Response listKeysWithResponse(Context context); /** - * Gets the Primary and Secondary ConnectionStrings to the namespace. + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Primary and Secondary ConnectionStrings to the namespace. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub. */ ResourceListKeys listKeys(); /** - * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. * - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param parameters Request content. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String along with {@link Response}. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * along with {@link Response}. */ - Response regenerateKeysWithResponse(PolicykeyResource parameters, Context context); + Response regenerateKeysWithResponse(PolicyKeyResource parameters, Context context); /** - * Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. * - * @param parameters Parameters supplied to regenerate the Namespace Authorization Rule Key. + * @param parameters Request content. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return namespace/NotificationHub Connection String. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings). */ - ResourceListKeys regenerateKeys(PolicykeyResource parameters); + ResourceListKeys regenerateKeys(PolicyKeyResource parameters); } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleResources.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleResources.java new file mode 100644 index 000000000000..fddc8b25ab09 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SharedAccessAuthorizationRuleResources.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of SharedAccessAuthorizationRuleResources. + */ +public interface SharedAccessAuthorizationRuleResources { + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name along with {@link Response}. + */ + Response getAuthorizationRuleWithResponse(String resourceGroupName, + String namespaceName, String notificationHubName, String authorizationRuleName, Context context); + + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name. + */ + SharedAccessAuthorizationRuleResource getAuthorizationRule(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName); + + /** + * Deletes a notificationHub authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteAuthorizationRuleWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, Context context); + + /** + * Deletes a notificationHub authorization rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, + String authorizationRuleName); + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. + */ + PagedIterable listAuthorizationRules(String resourceGroupName, + String namespaceName, String notificationHubName); + + /** + * Gets the authorization rules for a NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the authorization rules for a NotificationHub as paginated response with {@link PagedIterable}. + */ + PagedIterable listAuthorizationRules(String resourceGroupName, + String namespaceName, String notificationHubName, Context context); + + /** + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub along with {@link Response}. + */ + Response listKeysWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, Context context); + + /** + * Gets the Primary and Secondary ConnectionStrings to the NotificationHub. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Primary and Secondary ConnectionStrings to the NotificationHub. + */ + ResourceListKeys listKeys(String resourceGroupName, String namespaceName, String notificationHubName, + String authorizationRuleName); + + /** + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings) + * along with {@link Response}. + */ + Response regenerateKeysWithResponse(String resourceGroupName, String namespaceName, + String notificationHubName, String authorizationRuleName, PolicyKeyResource parameters, Context context); + + /** + * Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param namespaceName The name of the NamespaceResource. + * @param notificationHubName The name of the NotificationHubResource. + * @param authorizationRuleName The name of the SharedAccessAuthorizationRuleResource. + * @param parameters Request content. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the POST request that returns Namespace or NotificationHub access keys (connection strings). + */ + ResourceListKeys regenerateKeys(String resourceGroupName, String namespaceName, String notificationHubName, + String authorizationRuleName, PolicyKeyResource parameters); + + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name along with {@link Response}. + */ + SharedAccessAuthorizationRuleResource getAuthorizationRuleById(String id); + + /** + * Gets an authorization rule for a NotificationHub by name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an authorization rule for a NotificationHub by name along with {@link Response}. + */ + Response getAuthorizationRuleByIdWithResponse(String id, Context context); + + /** + * Deletes a notificationHub authorization rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteAuthorizationRuleById(String id); + + /** + * Deletes a notificationHub authorization rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteAuthorizationRuleByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SharedAccessAuthorizationRuleResource resource. + * + * @param name resource name. + * @return the first stage of the new SharedAccessAuthorizationRuleResource definition. + */ + SharedAccessAuthorizationRuleResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Sku.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Sku.java index bdec774e9217..e8816aa062d0 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Sku.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Sku.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; @@ -18,27 +18,27 @@ @Fluent public final class Sku implements JsonSerializable { /* - * Name of the notification hub sku + * Namespace SKU name. */ private SkuName name; /* - * The tier of particular sku + * Gets or sets the tier of particular sku */ private String tier; /* - * The Sku size + * Gets or sets the Sku size */ private String size; /* - * The Sku Family + * Gets or sets the Sku Family */ private String family; /* - * The capacity of the resource + * Gets or sets the capacity of the resource */ private Integer capacity; @@ -49,7 +49,7 @@ public Sku() { } /** - * Get the name property: Name of the notification hub sku. + * Get the name property: Namespace SKU name. * * @return the name value. */ @@ -58,7 +58,7 @@ public SkuName name() { } /** - * Set the name property: Name of the notification hub sku. + * Set the name property: Namespace SKU name. * * @param name the name value to set. * @return the Sku object itself. @@ -69,7 +69,7 @@ public Sku withName(SkuName name) { } /** - * Get the tier property: The tier of particular sku. + * Get the tier property: Gets or sets the tier of particular sku. * * @return the tier value. */ @@ -78,7 +78,7 @@ public String tier() { } /** - * Set the tier property: The tier of particular sku. + * Set the tier property: Gets or sets the tier of particular sku. * * @param tier the tier value to set. * @return the Sku object itself. @@ -89,7 +89,7 @@ public Sku withTier(String tier) { } /** - * Get the size property: The Sku size. + * Get the size property: Gets or sets the Sku size. * * @return the size value. */ @@ -98,7 +98,7 @@ public String size() { } /** - * Set the size property: The Sku size. + * Set the size property: Gets or sets the Sku size. * * @param size the size value to set. * @return the Sku object itself. @@ -109,7 +109,7 @@ public Sku withSize(String size) { } /** - * Get the family property: The Sku Family. + * Get the family property: Gets or sets the Sku Family. * * @return the family value. */ @@ -118,7 +118,7 @@ public String family() { } /** - * Set the family property: The Sku Family. + * Set the family property: Gets or sets the Sku Family. * * @param family the family value to set. * @return the Sku object itself. @@ -129,7 +129,7 @@ public Sku withFamily(String family) { } /** - * Get the capacity property: The capacity of the resource. + * Get the capacity property: Gets or sets the capacity of the resource. * * @return the capacity value. */ @@ -138,7 +138,7 @@ public Integer capacity() { } /** - * Set the capacity property: The capacity of the resource. + * Set the capacity property: Gets or sets the capacity of the resource. * * @param capacity the capacity value to set. * @return the Sku object itself. diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SkuName.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SkuName.java index 434a76e4811c..04c0487a59f1 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SkuName.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/SkuName.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; @@ -8,7 +8,7 @@ import java.util.Collection; /** - * Name of the notification hub sku. + * Namespace SKU name. */ public final class SkuName extends ExpandableStringEnum { /** diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/WnsCredential.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/WnsCredential.java index 4042f87d1915..22e10792905f 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/WnsCredential.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/WnsCredential.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,9 +19,9 @@ @Fluent public final class WnsCredential implements JsonSerializable { /* - * Properties of NotificationHub WnsCredential. + * Description of a NotificationHub WnsCredential. */ - private WnsCredentialProperties innerProperties; + private WnsCredentialProperties innerProperties = new WnsCredentialProperties(); /** * Creates an instance of WnsCredential class. @@ -29,7 +30,7 @@ public WnsCredential() { } /** - * Get the innerProperties property: Properties of NotificationHub WnsCredential. + * Get the innerProperties property: Description of a NotificationHub WnsCredential. * * @return the innerProperties value. */ @@ -38,7 +39,7 @@ private WnsCredentialProperties innerProperties() { } /** - * Get the packageSid property: The package ID for this credential. + * Get the packageSid property: Gets or sets the package ID for this credential. * * @return the packageSid value. */ @@ -47,7 +48,7 @@ public String packageSid() { } /** - * Set the packageSid property: The package ID for this credential. + * Set the packageSid property: Gets or sets the package ID for this credential. * * @param packageSid the packageSid value to set. * @return the WnsCredential object itself. @@ -61,7 +62,7 @@ public WnsCredential withPackageSid(String packageSid) { } /** - * Get the secretKey property: The secret key. + * Get the secretKey property: Gets or sets the secret key. * * @return the secretKey value. */ @@ -70,7 +71,7 @@ public String secretKey() { } /** - * Set the secretKey property: The secret key. + * Set the secretKey property: Gets or sets the secret key. * * @param secretKey the secretKey value to set. * @return the WnsCredential object itself. @@ -84,7 +85,7 @@ public WnsCredential withSecretKey(String secretKey) { } /** - * Get the windowsLiveEndpoint property: The Windows Live endpoint. + * Get the windowsLiveEndpoint property: Gets or sets the Windows Live endpoint. * * @return the windowsLiveEndpoint value. */ @@ -93,7 +94,7 @@ public String windowsLiveEndpoint() { } /** - * Set the windowsLiveEndpoint property: The Windows Live endpoint. + * Set the windowsLiveEndpoint property: Gets or sets the Windows Live endpoint. * * @param windowsLiveEndpoint the windowsLiveEndpoint value to set. * @return the WnsCredential object itself. @@ -106,17 +107,68 @@ public WnsCredential withWindowsLiveEndpoint(String windowsLiveEndpoint) { return this; } + /** + * Get the certificateKey property: Ges or sets the WNS Certificate Key. + * + * @return the certificateKey value. + */ + public String certificateKey() { + return this.innerProperties() == null ? null : this.innerProperties().certificateKey(); + } + + /** + * Set the certificateKey property: Ges or sets the WNS Certificate Key. + * + * @param certificateKey the certificateKey value to set. + * @return the WnsCredential object itself. + */ + public WnsCredential withCertificateKey(String certificateKey) { + if (this.innerProperties() == null) { + this.innerProperties = new WnsCredentialProperties(); + } + this.innerProperties().withCertificateKey(certificateKey); + return this; + } + + /** + * Get the wnsCertificate property: Gets or sets the WNS Certificate. + * + * @return the wnsCertificate value. + */ + public String wnsCertificate() { + return this.innerProperties() == null ? null : this.innerProperties().wnsCertificate(); + } + + /** + * Set the wnsCertificate property: Gets or sets the WNS Certificate. + * + * @param wnsCertificate the wnsCertificate value to set. + * @return the WnsCredential object itself. + */ + public WnsCredential withWnsCertificate(String wnsCertificate) { + if (this.innerProperties() == null) { + this.innerProperties = new WnsCredentialProperties(); + } + this.innerProperties().withWnsCertificate(wnsCertificate); + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (innerProperties() != null) { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model WnsCredential")); + } else { innerProperties().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(WnsCredential.class); + /** * {@inheritDoc} */ @@ -133,6 +185,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of WnsCredential if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the WnsCredential. */ public static WnsCredential fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/XiaomiCredential.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/XiaomiCredential.java new file mode 100644 index 000000000000..c4d2e28e9612 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/XiaomiCredential.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.notificationhubs.fluent.models.XiaomiCredentialProperties; +import java.io.IOException; + +/** + * Description of a NotificationHub XiaomiCredential. + */ +@Fluent +public final class XiaomiCredential implements JsonSerializable { + /* + * Description of a NotificationHub XiaomiCredentialProperties. + */ + private XiaomiCredentialProperties innerProperties = new XiaomiCredentialProperties(); + + /** + * Creates an instance of XiaomiCredential class. + */ + public XiaomiCredential() { + } + + /** + * Get the innerProperties property: Description of a NotificationHub XiaomiCredentialProperties. + * + * @return the innerProperties value. + */ + private XiaomiCredentialProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the appSecret property: Gets or sets app secret. + * + * @return the appSecret value. + */ + public String appSecret() { + return this.innerProperties() == null ? null : this.innerProperties().appSecret(); + } + + /** + * Set the appSecret property: Gets or sets app secret. + * + * @param appSecret the appSecret value to set. + * @return the XiaomiCredential object itself. + */ + public XiaomiCredential withAppSecret(String appSecret) { + if (this.innerProperties() == null) { + this.innerProperties = new XiaomiCredentialProperties(); + } + this.innerProperties().withAppSecret(appSecret); + return this; + } + + /** + * Get the endpoint property: Gets or sets xiaomi service endpoint. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.innerProperties() == null ? null : this.innerProperties().endpoint(); + } + + /** + * Set the endpoint property: Gets or sets xiaomi service endpoint. + * + * @param endpoint the endpoint value to set. + * @return the XiaomiCredential object itself. + */ + public XiaomiCredential withEndpoint(String endpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new XiaomiCredentialProperties(); + } + this.innerProperties().withEndpoint(endpoint); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model XiaomiCredential")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(XiaomiCredential.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of XiaomiCredential from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of XiaomiCredential if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the XiaomiCredential. + */ + public static XiaomiCredential fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + XiaomiCredential deserializedXiaomiCredential = new XiaomiCredential(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedXiaomiCredential.innerProperties = XiaomiCredentialProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedXiaomiCredential; + }); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ZoneRedundancyPreference.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ZoneRedundancyPreference.java new file mode 100644 index 000000000000..a9b275beac67 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/ZoneRedundancyPreference.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.notificationhubs.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Namespace SKU name. + */ +public final class ZoneRedundancyPreference extends ExpandableStringEnum { + /** + * Static value Disabled for ZoneRedundancyPreference. + */ + public static final ZoneRedundancyPreference DISABLED = fromString("Disabled"); + + /** + * Static value Enabled for ZoneRedundancyPreference. + */ + public static final ZoneRedundancyPreference ENABLED = fromString("Enabled"); + + /** + * Creates a new instance of ZoneRedundancyPreference value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ZoneRedundancyPreference() { + } + + /** + * Creates or finds a ZoneRedundancyPreference from its string representation. + * + * @param name a name to look for. + * @return the corresponding ZoneRedundancyPreference. + */ + public static ZoneRedundancyPreference fromString(String name) { + return fromString(name, ZoneRedundancyPreference.class); + } + + /** + * Gets known ZoneRedundancyPreference values. + * + * @return known ZoneRedundancyPreference values. + */ + public static Collection values() { + return values(ZoneRedundancyPreference.class); + } +} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/package-info.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/package-info.java index b03d3def3d54..a3cc7548ab2d 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/package-info.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the data models for NotificationHubsManagementClient. - * Azure NotificationHub client. + * Package containing the data models for Notificationhubs. + * Microsoft Notification Hubs Resource Provider REST API. */ package com.azure.resourcemanager.notificationhubs.models; diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/package-info.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/package-info.java index 97642cf41862..fb43f0ec6bf7 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/package-info.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the classes for NotificationHubsManagementClient. - * Azure NotificationHub client. + * Package containing the classes for Notificationhubs. + * Microsoft Notification Hubs Resource Provider REST API. */ package com.azure.resourcemanager.notificationhubs; diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/module-info.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/module-info.java index 69564d4da16f..655b18add909 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/module-info.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/module-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. module com.azure.resourcemanager.notificationhubs { requires transitive com.azure.core.management; @@ -12,4 +12,5 @@ opens com.azure.resourcemanager.notificationhubs.fluent.models to com.azure.core; opens com.azure.resourcemanager.notificationhubs.models to com.azure.core; + opens com.azure.resourcemanager.notificationhubs.implementation.models to com.azure.core; } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-notificationhubs/proxy-config.json b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-notificationhubs/proxy-config.json index 27840204c426..f2d3c302cae1 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-notificationhubs/proxy-config.json +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-notificationhubs/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.notificationhubs.implementation.NamespacesClientImpl$NamespacesService"],["com.azure.resourcemanager.notificationhubs.implementation.NotificationHubsClientImpl$NotificationHubsService"],["com.azure.resourcemanager.notificationhubs.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file +[["com.azure.resourcemanager.notificationhubs.implementation.NamespaceResourcesClientImpl$NamespaceResourcesService"],["com.azure.resourcemanager.notificationhubs.implementation.NamespacesClientImpl$NamespacesService"],["com.azure.resourcemanager.notificationhubs.implementation.NamespacesOperationGroupsClientImpl$NamespacesOperationGroupsService"],["com.azure.resourcemanager.notificationhubs.implementation.NotificationHubResourcesClientImpl$NotificationHubResourcesService"],["com.azure.resourcemanager.notificationhubs.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.notificationhubs.implementation.PrivateEndpointConnectionResourcesClientImpl$PrivateEndpointConnectionResourcesService"],["com.azure.resourcemanager.notificationhubs.implementation.PrivateLinkResourcesClientImpl$PrivateLinkResourcesService"],["com.azure.resourcemanager.notificationhubs.implementation.SharedAccessAuthorizationRuleResourcesClientImpl$SharedAccessAuthorizationRuleResourcesService"]] \ No newline at end of file diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/resources/azure-resourcemanager-notificationhubs.properties b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/resources/azure-resourcemanager-notificationhubs.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/resources/azure-resourcemanager-notificationhubs.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCheckAvailabilitySamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCheckAvailabilitySamples.java deleted file mode 100644 index 4e4ed03fd38b..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCheckAvailabilitySamples.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; - -/** - * Samples for Namespaces CheckAvailability. - */ -public final class NamespacesCheckAvailabilitySamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceCheckNameAvailability.json - */ - /** - * Sample code: NameSpaceCheckNameAvailability. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceCheckNameAvailability(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .checkAvailabilityWithResponse(new CheckAvailabilityParameters().withName("sdk-Namespace-2924"), - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCreateOrUpdateAuthorizationRuleSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCreateOrUpdateAuthorizationRuleSamples.java deleted file mode 100644 index d75ed5bf1bb9..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCreateOrUpdateAuthorizationRuleSamples.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; -import com.azure.resourcemanager.notificationhubs.models.AccessRights; -import java.util.Arrays; - -/** - * Samples for Namespaces CreateOrUpdateAuthorizationRule. - */ -public final class NamespacesCreateOrUpdateAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleCreate.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleCreate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleCreate(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .defineAuthorizationRule("sdk-AuthRules-1788") - .withExistingNamespace("5ktrial", "nh-sdk-ns") - .withProperties(new SharedAccessAuthorizationRuleProperties() - .withRights(Arrays.asList(AccessRights.LISTEN, AccessRights.SEND))) - .create(); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCreateOrUpdateSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCreateOrUpdateSamples.java deleted file mode 100644 index 18538588a146..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCreateOrUpdateSamples.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.util.HashMap; -import java.util.Map; - -/** - * Samples for Namespaces CreateOrUpdate. - */ -public final class NamespacesCreateOrUpdateSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceCreate.json - */ - /** - * Sample code: NameSpaceCreate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceCreate(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .define("nh-sdk-ns") - .withLocation("South Central US") - .withExistingResourceGroup("5ktrial") - .withTags(mapOf("tag1", "value1", "tag2", "value2")) - .withSku(new Sku().withName(SkuName.STANDARD).withTier("Standard")) - .create(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteAuthorizationRuleSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteAuthorizationRuleSamples.java deleted file mode 100644 index 4c32eca91511..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteAuthorizationRuleSamples.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for Namespaces DeleteAuthorizationRule. - */ -public final class NamespacesDeleteAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleDelete.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleDelete. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleDelete(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .deleteAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "RootManageSharedAccessKey", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteSamples.java deleted file mode 100644 index 0492ce8e917e..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteSamples.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for Namespaces Delete. - */ -public final class NamespacesDeleteSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceDelete.json - */ - /** - * Sample code: NameSpaceDelete. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceDelete(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().delete("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesGetAuthorizationRuleSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesGetAuthorizationRuleSamples.java deleted file mode 100644 index bcf13f6389a6..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesGetAuthorizationRuleSamples.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for Namespaces GetAuthorizationRule. - */ -public final class NamespacesGetAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleGet.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleGet. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleGet(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .getAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "RootManageSharedAccessKey", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesGetByResourceGroupSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesGetByResourceGroupSamples.java deleted file mode 100644 index 1f90d2124a62..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesGetByResourceGroupSamples.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for Namespaces GetByResourceGroup. - */ -public final class NamespacesGetByResourceGroupSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceGet.json - */ - /** - * Sample code: NameSpaceGet. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceGet(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().getByResourceGroupWithResponse("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListAuthorizationRulesSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListAuthorizationRulesSamples.java deleted file mode 100644 index cae7aba8455a..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListAuthorizationRulesSamples.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for Namespaces ListAuthorizationRules. - */ -public final class NamespacesListAuthorizationRulesSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleListAll.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleListAll. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleListAll(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().listAuthorizationRules("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListByResourceGroupSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListByResourceGroupSamples.java deleted file mode 100644 index b1f1f075ed9b..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListByResourceGroupSamples.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for Namespaces ListByResourceGroup. - */ -public final class NamespacesListByResourceGroupSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceListByResourceGroup.json - */ - /** - * Sample code: NameSpaceListByResourceGroup. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceListByResourceGroup(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().listByResourceGroup("5ktrial", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListKeysSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListKeysSamples.java deleted file mode 100644 index 5d61dc035ddc..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListKeysSamples.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for Namespaces ListKeys. - */ -public final class NamespacesListKeysSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleListKey.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleListKey. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - nameSpaceAuthorizationRuleListKey(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .listKeysWithResponse("5ktrial", "nh-sdk-ns", "RootManageSharedAccessKey", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListSamples.java deleted file mode 100644 index b10554c7860f..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListSamples.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for Namespaces List. - */ -public final class NamespacesListSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceList.json - */ - /** - * Sample code: NameSpaceList. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceList(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces().list(com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesPatchSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesPatchSamples.java deleted file mode 100644 index 84c9b6b84cce..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesPatchSamples.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.resourcemanager.notificationhubs.models.NamespaceResource; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.util.HashMap; -import java.util.Map; - -/** - * Samples for Namespaces Patch. - */ -public final class NamespacesPatchSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceUpdate.json - */ - /** - * Sample code: NameSpaceUpdate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceUpdate(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - NamespaceResource resource = manager.namespaces() - .getByResourceGroupWithResponse("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE) - .getValue(); - resource.update() - .withTags(mapOf("tag1", "value1", "tag2", "value2")) - .withSku(new Sku().withName(SkuName.STANDARD).withTier("Standard")) - .apply(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesRegenerateKeysSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesRegenerateKeysSamples.java deleted file mode 100644 index 61f58f615218..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesRegenerateKeysSamples.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; - -/** - * Samples for Namespaces RegenerateKeys. - */ -public final class NamespacesRegenerateKeysSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/Namespaces/ - * NHNameSpaceAuthorizationRuleRegenrateKey.json - */ - /** - * Sample code: NameSpaceAuthorizationRuleRegenerateKey. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void nameSpaceAuthorizationRuleRegenerateKey( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.namespaces() - .regenerateKeysWithResponse("5ktrial", "nh-sdk-ns", "RootManageSharedAccessKey", - new PolicykeyResource().withPolicyKey("fakeTokenPlaceholder"), com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCheckNotificationHubAvailabilitySamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCheckNotificationHubAvailabilitySamples.java deleted file mode 100644 index 70de37304883..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCheckNotificationHubAvailabilitySamples.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; - -/** - * Samples for NotificationHubs CheckNotificationHubAvailability. - */ -public final class NotificationHubsCheckNotificationHubAvailabilitySamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubCheckNameAvailability.json - */ - /** - * Sample code: notificationHubCheckNameAvailability. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubCheckNameAvailability( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .checkNotificationHubAvailabilityWithResponse("5ktrial", "locp-newns", - new CheckAvailabilityParameters().withName("sdktest").withLocation("West Europe"), - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCreateOrUpdateAuthorizationRuleSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCreateOrUpdateAuthorizationRuleSamples.java deleted file mode 100644 index f4dbdaeb75fa..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCreateOrUpdateAuthorizationRuleSamples.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.resourcemanager.notificationhubs.fluent.models.SharedAccessAuthorizationRuleProperties; -import com.azure.resourcemanager.notificationhubs.models.AccessRights; -import com.azure.resourcemanager.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters; -import java.util.Arrays; - -/** - * Samples for NotificationHubs CreateOrUpdateAuthorizationRule. - */ -public final class NotificationHubsCreateOrUpdateAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleCreate.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleCreate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleCreate( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .createOrUpdateAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", - "DefaultListenSharedAccessSignature", - new SharedAccessAuthorizationRuleCreateOrUpdateParameters() - .withProperties(new SharedAccessAuthorizationRuleProperties() - .withRights(Arrays.asList(AccessRights.LISTEN, AccessRights.SEND))), - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCreateOrUpdateSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCreateOrUpdateSamples.java deleted file mode 100644 index 64efdd2eb529..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCreateOrUpdateSamples.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for NotificationHubs CreateOrUpdate. - */ -public final class NotificationHubsCreateOrUpdateSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubCreate.json - */ - /** - * Sample code: NotificationHubCreate. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubCreate(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .define("nh-sdk-hub") - .withRegion("eastus") - .withExistingNamespace("5ktrial", "nh-sdk-ns") - .create(); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDebugSendSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDebugSendSamples.java deleted file mode 100644 index 51f7eb76529c..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDebugSendSamples.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; - -/** - * Samples for NotificationHubs DebugSend. - */ -public final class NotificationHubsDebugSendSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubDebugSend.json - */ - /** - * Sample code: debugsend. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void debugsend(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) - throws IOException { - manager.notificationHubs() - .debugSendWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", - SerializerFactory.createDefaultManagementSerializerAdapter() - .deserialize("{\"data\":{\"message\":\"Hello\"}}", Object.class, SerializerEncoding.JSON), - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteAuthorizationRuleSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteAuthorizationRuleSamples.java deleted file mode 100644 index bd15371f0a1b..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteAuthorizationRuleSamples.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for NotificationHubs DeleteAuthorizationRule. - */ -public final class NotificationHubsDeleteAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleDelete.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleDelete. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleDelete( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .deleteAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", - "DefaultListenSharedAccessSignature", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteSamples.java deleted file mode 100644 index 5d4a9929581f..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteSamples.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for NotificationHubs Delete. - */ -public final class NotificationHubsDeleteSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubDelete.json - */ - /** - * Sample code: NotificationHubDelete. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubDelete(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .deleteWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsGetAuthorizationRuleSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsGetAuthorizationRuleSamples.java deleted file mode 100644 index 1a835af81a46..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsGetAuthorizationRuleSamples.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for NotificationHubs GetAuthorizationRule. - */ -public final class NotificationHubsGetAuthorizationRuleSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleGet.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleGet. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleGet( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .getAuthorizationRuleWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", - "DefaultListenSharedAccessSignature", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsGetPnsCredentialsSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsGetPnsCredentialsSamples.java deleted file mode 100644 index cd2629ada3ce..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsGetPnsCredentialsSamples.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for NotificationHubs GetPnsCredentials. - */ -public final class NotificationHubsGetPnsCredentialsSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubPnsCredentials.json - */ - /** - * Sample code: notificationHubPnsCredentials. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubPnsCredentials(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .getPnsCredentialsWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsGetSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsGetSamples.java deleted file mode 100644 index 17ee83fcabdf..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsGetSamples.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for NotificationHubs Get. - */ -public final class NotificationHubsGetSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubGet.json - */ - /** - * Sample code: NotificationHubGet. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubGet(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .getWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsListAuthorizationRulesSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsListAuthorizationRulesSamples.java deleted file mode 100644 index b0f1c25057ce..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsListAuthorizationRulesSamples.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for NotificationHubs ListAuthorizationRules. - */ -public final class NotificationHubsListAuthorizationRulesSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleListAll.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleListAll. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleListAll( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .listAuthorizationRules("5ktrial", "nh-sdk-ns", "nh-sdk-hub", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsListKeysSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsListKeysSamples.java deleted file mode 100644 index 710e571fe1cf..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsListKeysSamples.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for NotificationHubs ListKeys. - */ -public final class NotificationHubsListKeysSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleListKey.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleListKey. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleListKey( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .listKeysWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", "sdk-AuthRules-5800", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsListSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsListSamples.java deleted file mode 100644 index 1a3b57df718e..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsListSamples.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -/** - * Samples for NotificationHubs List. - */ -public final class NotificationHubsListSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubListByNameSpace.json - */ - /** - * Sample code: NotificationHubListByNameSpace. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubListByNameSpace(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs().list("5ktrial", "nh-sdk-ns", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsPatchSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsPatchSamples.java deleted file mode 100644 index 4ce8b17e69d5..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsPatchSamples.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.resourcemanager.notificationhubs.models.NotificationHubResource; - -/** - * Samples for NotificationHubs Patch. - */ -public final class NotificationHubsPatchSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubPatch.json - */ - /** - * Sample code: NotificationHubPatch. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void - notificationHubPatch(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - NotificationHubResource resource = manager.notificationHubs() - .getWithResponse("sdkresourceGroup", "nh-sdk-ns", "sdk-notificationHubs-8708", - com.azure.core.util.Context.NONE) - .getValue(); - resource.update().apply(); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsRegenerateKeysSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsRegenerateKeysSamples.java deleted file mode 100644 index f573c74abdfb..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsRegenerateKeysSamples.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.resourcemanager.notificationhubs.models.PolicykeyResource; - -/** - * Samples for NotificationHubs RegenerateKeys. - */ -public final class NotificationHubsRegenerateKeysSamples { - /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NotificationHubs/NotificationHubAuthorizationRuleRegenrateKey.json - */ - /** - * Sample code: NotificationHubAuthorizationRuleRegenrateKey. - * - * @param manager Entry point to NotificationHubsManager. - */ - public static void notificationHubAuthorizationRuleRegenrateKey( - com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { - manager.notificationHubs() - .regenerateKeysWithResponse("5ktrial", "nh-sdk-ns", "nh-sdk-hub", "DefaultListenSharedAccessSignature", - new PolicykeyResource().withPolicyKey("fakeTokenPlaceholder"), com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/OperationsListSamples.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/OperationsListSamples.java index a24a4fea4d76..a7b64cfea911 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/OperationsListSamples.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/samples/java/com/azure/resourcemanager/notificationhubs/generated/OperationsListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.generated; @@ -9,16 +9,14 @@ */ public final class OperationsListSamples { /* - * x-ms-original-file: - * specification/notificationhubs/resource-manager/Microsoft.NotificationHubs/stable/2017-04-01/examples/ - * NHOperationsList.json + * x-ms-original-file: 2023-10-01-preview/NHOperationsList.json */ /** - * Sample code: OperationsList. + * Sample code: Operations_List. * - * @param manager Entry point to NotificationHubsManager. + * @param manager Entry point to NotificationhubsManager. */ - public static void operationsList(com.azure.resourcemanager.notificationhubs.NotificationHubsManager manager) { + public static void operationsList(com.azure.resourcemanager.notificationhubs.NotificationhubsManager manager) { manager.operations().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/CheckAvailabilityParametersTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/CheckAvailabilityParametersTests.java deleted file mode 100644 index b531a30dfcea..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/CheckAvailabilityParametersTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class CheckAvailabilityParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckAvailabilityParameters model = BinaryData.fromString( - "{\"id\":\"pewnw\",\"name\":\"eitjz\",\"type\":\"lusarh\",\"location\":\"fcqhsmyurkd\",\"tags\":{\"arcryuanzwuxzdxt\":\"xhekuksjtxukcdm\"},\"sku\":{\"name\":\"Standard\",\"tier\":\"hmwhfpmrqo\",\"size\":\"tu\",\"family\":\"nryrtihf\",\"capacity\":1773018691},\"isAvailiable\":false}") - .toObject(CheckAvailabilityParameters.class); - Assertions.assertEquals("eitjz", model.name()); - Assertions.assertEquals("fcqhsmyurkd", model.location()); - Assertions.assertEquals("xhekuksjtxukcdm", model.tags().get("arcryuanzwuxzdxt")); - Assertions.assertEquals(SkuName.STANDARD, model.sku().name()); - Assertions.assertEquals("hmwhfpmrqo", model.sku().tier()); - Assertions.assertEquals("tu", model.sku().size()); - Assertions.assertEquals("nryrtihf", model.sku().family()); - Assertions.assertEquals(1773018691, model.sku().capacity()); - Assertions.assertEquals(false, model.isAvailiable()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckAvailabilityParameters model = new CheckAvailabilityParameters().withName("eitjz") - .withLocation("fcqhsmyurkd") - .withTags(mapOf("arcryuanzwuxzdxt", "xhekuksjtxukcdm")) - .withSku(new Sku().withName(SkuName.STANDARD) - .withTier("hmwhfpmrqo") - .withSize("tu") - .withFamily("nryrtihf") - .withCapacity(1773018691)) - .withIsAvailiable(false); - model = BinaryData.fromObject(model).toObject(CheckAvailabilityParameters.class); - Assertions.assertEquals("eitjz", model.name()); - Assertions.assertEquals("fcqhsmyurkd", model.location()); - Assertions.assertEquals("xhekuksjtxukcdm", model.tags().get("arcryuanzwuxzdxt")); - Assertions.assertEquals(SkuName.STANDARD, model.sku().name()); - Assertions.assertEquals("hmwhfpmrqo", model.sku().tier()); - Assertions.assertEquals("tu", model.sku().size()); - Assertions.assertEquals("nryrtihf", model.sku().family()); - Assertions.assertEquals(1773018691, model.sku().capacity()); - Assertions.assertEquals(false, model.isAvailiable()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/CheckAvailabilityResultInnerTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/CheckAvailabilityResultInnerTests.java deleted file mode 100644 index 3cd395d372fd..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/CheckAvailabilityResultInnerTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.fluent.models.CheckAvailabilityResultInner; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class CheckAvailabilityResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckAvailabilityResultInner model = BinaryData.fromString( - "{\"isAvailiable\":false,\"sku\":{\"name\":\"Standard\",\"tier\":\"fpikxwczb\",\"size\":\"cnpqxuhivyqniwby\",\"family\":\"k\",\"capacity\":827133079},\"location\":\"umjgrtfwvuk\",\"tags\":{\"yejhk\":\"udccsnhsjc\",\"kkvnipjox\":\"yhtnapczwlokjye\",\"podmailzydehojwy\":\"jnchgej\"},\"id\":\"huxinpmqnj\",\"name\":\"qwixjspro\",\"type\":\"vcputegj\"}") - .toObject(CheckAvailabilityResultInner.class); - Assertions.assertEquals("umjgrtfwvuk", model.location()); - Assertions.assertEquals("udccsnhsjc", model.tags().get("yejhk")); - Assertions.assertEquals(false, model.isAvailiable()); - Assertions.assertEquals(SkuName.STANDARD, model.sku().name()); - Assertions.assertEquals("fpikxwczb", model.sku().tier()); - Assertions.assertEquals("cnpqxuhivyqniwby", model.sku().size()); - Assertions.assertEquals("k", model.sku().family()); - Assertions.assertEquals(827133079, model.sku().capacity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckAvailabilityResultInner model = new CheckAvailabilityResultInner().withLocation("umjgrtfwvuk") - .withTags(mapOf("yejhk", "udccsnhsjc", "kkvnipjox", "yhtnapczwlokjye", "podmailzydehojwy", "jnchgej")) - .withIsAvailiable(false) - .withSku(new Sku().withName(SkuName.STANDARD) - .withTier("fpikxwczb") - .withSize("cnpqxuhivyqniwby") - .withFamily("k") - .withCapacity(827133079)); - model = BinaryData.fromObject(model).toObject(CheckAvailabilityResultInner.class); - Assertions.assertEquals("umjgrtfwvuk", model.location()); - Assertions.assertEquals("udccsnhsjc", model.tags().get("yejhk")); - Assertions.assertEquals(false, model.isAvailiable()); - Assertions.assertEquals(SkuName.STANDARD, model.sku().name()); - Assertions.assertEquals("fpikxwczb", model.sku().tier()); - Assertions.assertEquals("cnpqxuhivyqniwby", model.sku().size()); - Assertions.assertEquals("k", model.sku().family()); - Assertions.assertEquals(827133079, model.sku().capacity()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/DebugSendResponseInnerTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/DebugSendResponseInnerTests.java deleted file mode 100644 index 819093cc7fff..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/DebugSendResponseInnerTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResponseInner; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DebugSendResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DebugSendResponseInner model = BinaryData.fromString( - "{\"properties\":{\"success\":62.422825,\"failure\":22.030466,\"results\":\"datasxlzevgbmqj\"},\"sku\":{\"name\":\"Standard\",\"tier\":\"y\",\"size\":\"ivkwlzuvccfwnfnb\",\"family\":\"fionl\",\"capacity\":10134075},\"location\":\"etqgtzxdpnq\",\"tags\":{\"snjampmng\":\"wxrjfeallnwsub\",\"chcbonqvpkvlrxnj\":\"zscxaqwo\",\"pheoflokeyy\":\"ase\"},\"id\":\"enjbdlwtgrhp\",\"name\":\"jp\",\"type\":\"umasxazjpq\"}") - .toObject(DebugSendResponseInner.class); - Assertions.assertEquals("etqgtzxdpnq", model.location()); - Assertions.assertEquals("wxrjfeallnwsub", model.tags().get("snjampmng")); - Assertions.assertEquals(SkuName.STANDARD, model.sku().name()); - Assertions.assertEquals("y", model.sku().tier()); - Assertions.assertEquals("ivkwlzuvccfwnfnb", model.sku().size()); - Assertions.assertEquals("fionl", model.sku().family()); - Assertions.assertEquals(10134075, model.sku().capacity()); - Assertions.assertEquals(62.422825F, model.success()); - Assertions.assertEquals(22.030466F, model.failure()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DebugSendResponseInner model = new DebugSendResponseInner().withLocation("etqgtzxdpnq") - .withTags(mapOf("snjampmng", "wxrjfeallnwsub", "chcbonqvpkvlrxnj", "zscxaqwo", "pheoflokeyy", - "fakeTokenPlaceholder")) - .withSku(new Sku().withName(SkuName.STANDARD) - .withTier("y") - .withSize("ivkwlzuvccfwnfnb") - .withFamily("fionl") - .withCapacity(10134075)) - .withSuccess(62.422825F) - .withFailure(22.030466F) - .withResults("datasxlzevgbmqj"); - model = BinaryData.fromObject(model).toObject(DebugSendResponseInner.class); - Assertions.assertEquals("etqgtzxdpnq", model.location()); - Assertions.assertEquals("wxrjfeallnwsub", model.tags().get("snjampmng")); - Assertions.assertEquals(SkuName.STANDARD, model.sku().name()); - Assertions.assertEquals("y", model.sku().tier()); - Assertions.assertEquals("ivkwlzuvccfwnfnb", model.sku().size()); - Assertions.assertEquals("fionl", model.sku().family()); - Assertions.assertEquals(10134075, model.sku().capacity()); - Assertions.assertEquals(62.422825F, model.success()); - Assertions.assertEquals(22.030466F, model.failure()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/DebugSendResultTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/DebugSendResultTests.java deleted file mode 100644 index 544944ae313f..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/DebugSendResultTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.fluent.models.DebugSendResult; -import org.junit.jupiter.api.Assertions; - -public final class DebugSendResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DebugSendResult model - = BinaryData.fromString("{\"success\":22.663057,\"failure\":29.506851,\"results\":\"datahb\"}") - .toObject(DebugSendResult.class); - Assertions.assertEquals(22.663057F, model.success()); - Assertions.assertEquals(29.506851F, model.failure()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DebugSendResult model - = new DebugSendResult().withSuccess(22.663057F).withFailure(29.506851F).withResults("datahb"); - model = BinaryData.fromObject(model).toObject(DebugSendResult.class); - Assertions.assertEquals(22.663057F, model.success()); - Assertions.assertEquals(29.506851F, model.failure()); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespaceCreateOrUpdateParametersTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespaceCreateOrUpdateParametersTests.java deleted file mode 100644 index e86ef5fbd653..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespaceCreateOrUpdateParametersTests.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.models.NamespaceCreateOrUpdateParameters; -import com.azure.resourcemanager.notificationhubs.models.NamespaceType; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class NamespaceCreateOrUpdateParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NamespaceCreateOrUpdateParameters model = BinaryData.fromString( - "{\"properties\":{\"name\":\"fdatsc\",\"provisioningState\":\"vpjhulsuuv\",\"region\":\"jozkrwfndiod\",\"metricId\":\"slwejdpvw\",\"status\":\"oqpsoa\",\"createdAt\":\"2021-07-20T12:53:26Z\",\"updatedAt\":\"2021-10-30T16:42:46Z\",\"serviceBusEndpoint\":\"kljla\",\"subscriptionId\":\"cr\",\"scaleUnit\":\"fdfdosygexpa\",\"enabled\":true,\"critical\":true,\"dataCenter\":\"sbzjhcr\",\"namespaceType\":\"NotificationHub\"},\"sku\":{\"name\":\"Free\",\"tier\":\"lxaolthqtrgqjbp\",\"size\":\"fsinzgvfcjrwzoxx\",\"family\":\"felluwfzitonpe\",\"capacity\":794210755},\"location\":\"jkjlxofpdvhpfx\",\"tags\":{\"uybbkpodep\":\"ininmay\"},\"id\":\"oginuvamiheognar\",\"name\":\"zxtheotusivyevcc\",\"type\":\"qi\"}") - .toObject(NamespaceCreateOrUpdateParameters.class); - Assertions.assertEquals("jkjlxofpdvhpfx", model.location()); - Assertions.assertEquals("ininmay", model.tags().get("uybbkpodep")); - Assertions.assertEquals(SkuName.FREE, model.sku().name()); - Assertions.assertEquals("lxaolthqtrgqjbp", model.sku().tier()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.sku().size()); - Assertions.assertEquals("felluwfzitonpe", model.sku().family()); - Assertions.assertEquals(794210755, model.sku().capacity()); - Assertions.assertEquals("fdatsc", model.namePropertiesName()); - Assertions.assertEquals("vpjhulsuuv", model.provisioningState()); - Assertions.assertEquals("jozkrwfndiod", model.region()); - Assertions.assertEquals("oqpsoa", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-20T12:53:26Z"), model.createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-30T16:42:46Z"), model.updatedAt()); - Assertions.assertEquals("kljla", model.serviceBusEndpoint()); - Assertions.assertEquals("cr", model.subscriptionId()); - Assertions.assertEquals("fdfdosygexpa", model.scaleUnit()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(true, model.critical()); - Assertions.assertEquals("sbzjhcr", model.dataCenter()); - Assertions.assertEquals(NamespaceType.NOTIFICATION_HUB, model.namespaceType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NamespaceCreateOrUpdateParameters model = new NamespaceCreateOrUpdateParameters().withLocation("jkjlxofpdvhpfx") - .withTags(mapOf("uybbkpodep", "ininmay")) - .withSku(new Sku().withName(SkuName.FREE) - .withTier("lxaolthqtrgqjbp") - .withSize("fsinzgvfcjrwzoxx") - .withFamily("felluwfzitonpe") - .withCapacity(794210755)) - .withNamePropertiesName("fdatsc") - .withProvisioningState("vpjhulsuuv") - .withRegion("jozkrwfndiod") - .withStatus("oqpsoa") - .withCreatedAt(OffsetDateTime.parse("2021-07-20T12:53:26Z")) - .withUpdatedAt(OffsetDateTime.parse("2021-10-30T16:42:46Z")) - .withServiceBusEndpoint("kljla") - .withSubscriptionId("cr") - .withScaleUnit("fdfdosygexpa") - .withEnabled(true) - .withCritical(true) - .withDataCenter("sbzjhcr") - .withNamespaceType(NamespaceType.NOTIFICATION_HUB); - model = BinaryData.fromObject(model).toObject(NamespaceCreateOrUpdateParameters.class); - Assertions.assertEquals("jkjlxofpdvhpfx", model.location()); - Assertions.assertEquals("ininmay", model.tags().get("uybbkpodep")); - Assertions.assertEquals(SkuName.FREE, model.sku().name()); - Assertions.assertEquals("lxaolthqtrgqjbp", model.sku().tier()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.sku().size()); - Assertions.assertEquals("felluwfzitonpe", model.sku().family()); - Assertions.assertEquals(794210755, model.sku().capacity()); - Assertions.assertEquals("fdatsc", model.namePropertiesName()); - Assertions.assertEquals("vpjhulsuuv", model.provisioningState()); - Assertions.assertEquals("jozkrwfndiod", model.region()); - Assertions.assertEquals("oqpsoa", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-20T12:53:26Z"), model.createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-30T16:42:46Z"), model.updatedAt()); - Assertions.assertEquals("kljla", model.serviceBusEndpoint()); - Assertions.assertEquals("cr", model.subscriptionId()); - Assertions.assertEquals("fdfdosygexpa", model.scaleUnit()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(true, model.critical()); - Assertions.assertEquals("sbzjhcr", model.dataCenter()); - Assertions.assertEquals(NamespaceType.NOTIFICATION_HUB, model.namespaceType()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespaceListResultTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespaceListResultTests.java deleted file mode 100644 index d188f707868d..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespaceListResultTests.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; -import com.azure.resourcemanager.notificationhubs.models.NamespaceListResult; -import com.azure.resourcemanager.notificationhubs.models.NamespaceType; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class NamespaceListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NamespaceListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"name\":\"fqawrlyxw\",\"provisioningState\":\"cpr\",\"region\":\"wbxgjvt\",\"metricId\":\"p\",\"status\":\"szdnr\",\"createdAt\":\"2021-06-20T01:52:55Z\",\"updatedAt\":\"2021-10-21T17:39:02Z\",\"serviceBusEndpoint\":\"muouqfp\",\"subscriptionId\":\"zw\",\"scaleUnit\":\"g\",\"enabled\":false,\"critical\":false,\"dataCenter\":\"izgazxu\",\"namespaceType\":\"Messaging\"},\"sku\":{\"name\":\"Free\",\"tier\":\"y\",\"size\":\"hr\",\"family\":\"dfvzwdzuhty\",\"capacity\":1847084741},\"location\":\"sdkf\",\"tags\":{\"km\":\"xmnteiwaop\",\"mzidnsezcxtb\":\"jcmmxdcufufsrp\",\"dwzjeiach\":\"sgfyccsnew\"},\"id\":\"oosflnr\",\"name\":\"sfqpteehz\",\"type\":\"vypyqrimzinpv\"}],\"nextLink\":\"jdkirsoodqx\"}") - .toObject(NamespaceListResult.class); - Assertions.assertEquals("sdkf", model.value().get(0).location()); - Assertions.assertEquals("xmnteiwaop", model.value().get(0).tags().get("km")); - Assertions.assertEquals(SkuName.FREE, model.value().get(0).sku().name()); - Assertions.assertEquals("y", model.value().get(0).sku().tier()); - Assertions.assertEquals("hr", model.value().get(0).sku().size()); - Assertions.assertEquals("dfvzwdzuhty", model.value().get(0).sku().family()); - Assertions.assertEquals(1847084741, model.value().get(0).sku().capacity()); - Assertions.assertEquals("fqawrlyxw", model.value().get(0).namePropertiesName()); - Assertions.assertEquals("cpr", model.value().get(0).provisioningState()); - Assertions.assertEquals("wbxgjvt", model.value().get(0).region()); - Assertions.assertEquals("szdnr", model.value().get(0).status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-20T01:52:55Z"), model.value().get(0).createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-21T17:39:02Z"), model.value().get(0).updatedAt()); - Assertions.assertEquals("muouqfp", model.value().get(0).serviceBusEndpoint()); - Assertions.assertEquals("zw", model.value().get(0).subscriptionId()); - Assertions.assertEquals("g", model.value().get(0).scaleUnit()); - Assertions.assertEquals(false, model.value().get(0).enabled()); - Assertions.assertEquals(false, model.value().get(0).critical()); - Assertions.assertEquals("izgazxu", model.value().get(0).dataCenter()); - Assertions.assertEquals(NamespaceType.MESSAGING, model.value().get(0).namespaceType()); - Assertions.assertEquals("jdkirsoodqx", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NamespaceListResult model - = new NamespaceListResult().withValue(Arrays.asList(new NamespaceResourceInner().withLocation("sdkf") - .withTags(mapOf("km", "xmnteiwaop", "mzidnsezcxtb", "jcmmxdcufufsrp", "dwzjeiach", "sgfyccsnew")) - .withSku(new Sku().withName(SkuName.FREE) - .withTier("y") - .withSize("hr") - .withFamily("dfvzwdzuhty") - .withCapacity(1847084741)) - .withNamePropertiesName("fqawrlyxw") - .withProvisioningState("cpr") - .withRegion("wbxgjvt") - .withStatus("szdnr") - .withCreatedAt(OffsetDateTime.parse("2021-06-20T01:52:55Z")) - .withUpdatedAt(OffsetDateTime.parse("2021-10-21T17:39:02Z")) - .withServiceBusEndpoint("muouqfp") - .withSubscriptionId("zw") - .withScaleUnit("g") - .withEnabled(false) - .withCritical(false) - .withDataCenter("izgazxu") - .withNamespaceType(NamespaceType.MESSAGING))).withNextLink("jdkirsoodqx"); - model = BinaryData.fromObject(model).toObject(NamespaceListResult.class); - Assertions.assertEquals("sdkf", model.value().get(0).location()); - Assertions.assertEquals("xmnteiwaop", model.value().get(0).tags().get("km")); - Assertions.assertEquals(SkuName.FREE, model.value().get(0).sku().name()); - Assertions.assertEquals("y", model.value().get(0).sku().tier()); - Assertions.assertEquals("hr", model.value().get(0).sku().size()); - Assertions.assertEquals("dfvzwdzuhty", model.value().get(0).sku().family()); - Assertions.assertEquals(1847084741, model.value().get(0).sku().capacity()); - Assertions.assertEquals("fqawrlyxw", model.value().get(0).namePropertiesName()); - Assertions.assertEquals("cpr", model.value().get(0).provisioningState()); - Assertions.assertEquals("wbxgjvt", model.value().get(0).region()); - Assertions.assertEquals("szdnr", model.value().get(0).status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-20T01:52:55Z"), model.value().get(0).createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-21T17:39:02Z"), model.value().get(0).updatedAt()); - Assertions.assertEquals("muouqfp", model.value().get(0).serviceBusEndpoint()); - Assertions.assertEquals("zw", model.value().get(0).subscriptionId()); - Assertions.assertEquals("g", model.value().get(0).scaleUnit()); - Assertions.assertEquals(false, model.value().get(0).enabled()); - Assertions.assertEquals(false, model.value().get(0).critical()); - Assertions.assertEquals("izgazxu", model.value().get(0).dataCenter()); - Assertions.assertEquals(NamespaceType.MESSAGING, model.value().get(0).namespaceType()); - Assertions.assertEquals("jdkirsoodqx", model.nextLink()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacePatchParametersTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacePatchParametersTests.java deleted file mode 100644 index cc43a77c05cd..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacePatchParametersTests.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.models.NamespacePatchParameters; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class NamespacePatchParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NamespacePatchParameters model = BinaryData.fromString( - "{\"tags\":{\"xybz\":\"akeqs\",\"mnkzsmod\":\"qedqytbciqfoufl\"},\"sku\":{\"name\":\"Standard\",\"tier\":\"ugpbkw\",\"size\":\"utduqktapspwgcu\",\"family\":\"tumkdosvqwhbm\",\"capacity\":1497620633}}") - .toObject(NamespacePatchParameters.class); - Assertions.assertEquals("akeqs", model.tags().get("xybz")); - Assertions.assertEquals(SkuName.STANDARD, model.sku().name()); - Assertions.assertEquals("ugpbkw", model.sku().tier()); - Assertions.assertEquals("utduqktapspwgcu", model.sku().size()); - Assertions.assertEquals("tumkdosvqwhbm", model.sku().family()); - Assertions.assertEquals(1497620633, model.sku().capacity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NamespacePatchParameters model - = new NamespacePatchParameters().withTags(mapOf("xybz", "akeqs", "mnkzsmod", "qedqytbciqfoufl")) - .withSku(new Sku().withName(SkuName.STANDARD) - .withTier("ugpbkw") - .withSize("utduqktapspwgcu") - .withFamily("tumkdosvqwhbm") - .withCapacity(1497620633)); - model = BinaryData.fromObject(model).toObject(NamespacePatchParameters.class); - Assertions.assertEquals("akeqs", model.tags().get("xybz")); - Assertions.assertEquals(SkuName.STANDARD, model.sku().name()); - Assertions.assertEquals("ugpbkw", model.sku().tier()); - Assertions.assertEquals("utduqktapspwgcu", model.sku().size()); - Assertions.assertEquals("tumkdosvqwhbm", model.sku().family()); - Assertions.assertEquals(1497620633, model.sku().capacity()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacePropertiesTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacePropertiesTests.java deleted file mode 100644 index c2b05c1805f8..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacePropertiesTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceProperties; -import com.azure.resourcemanager.notificationhubs.models.NamespaceType; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class NamespacePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NamespaceProperties model = BinaryData.fromString( - "{\"name\":\"hungbwjzrnf\",\"provisioningState\":\"xgispemvtzfkufu\",\"region\":\"jofxqe\",\"metricId\":\"jaeq\",\"status\":\"qjbasvms\",\"createdAt\":\"2021-08-09T10:57:51Z\",\"updatedAt\":\"2021-09-27T07:52:20Z\",\"serviceBusEndpoint\":\"gsntnbybkzgcwr\",\"subscriptionId\":\"lxxwrljdouskc\",\"scaleUnit\":\"kocrcjdkwtnhx\",\"enabled\":true,\"critical\":false,\"dataCenter\":\"sqrglssainq\",\"namespaceType\":\"NotificationHub\"}") - .toObject(NamespaceProperties.class); - Assertions.assertEquals("hungbwjzrnf", model.name()); - Assertions.assertEquals("xgispemvtzfkufu", model.provisioningState()); - Assertions.assertEquals("jofxqe", model.region()); - Assertions.assertEquals("qjbasvms", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-09T10:57:51Z"), model.createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-27T07:52:20Z"), model.updatedAt()); - Assertions.assertEquals("gsntnbybkzgcwr", model.serviceBusEndpoint()); - Assertions.assertEquals("lxxwrljdouskc", model.subscriptionId()); - Assertions.assertEquals("kocrcjdkwtnhx", model.scaleUnit()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(false, model.critical()); - Assertions.assertEquals("sqrglssainq", model.dataCenter()); - Assertions.assertEquals(NamespaceType.NOTIFICATION_HUB, model.namespaceType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NamespaceProperties model = new NamespaceProperties().withName("hungbwjzrnf") - .withProvisioningState("xgispemvtzfkufu") - .withRegion("jofxqe") - .withStatus("qjbasvms") - .withCreatedAt(OffsetDateTime.parse("2021-08-09T10:57:51Z")) - .withUpdatedAt(OffsetDateTime.parse("2021-09-27T07:52:20Z")) - .withServiceBusEndpoint("gsntnbybkzgcwr") - .withSubscriptionId("lxxwrljdouskc") - .withScaleUnit("kocrcjdkwtnhx") - .withEnabled(true) - .withCritical(false) - .withDataCenter("sqrglssainq") - .withNamespaceType(NamespaceType.NOTIFICATION_HUB); - model = BinaryData.fromObject(model).toObject(NamespaceProperties.class); - Assertions.assertEquals("hungbwjzrnf", model.name()); - Assertions.assertEquals("xgispemvtzfkufu", model.provisioningState()); - Assertions.assertEquals("jofxqe", model.region()); - Assertions.assertEquals("qjbasvms", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-09T10:57:51Z"), model.createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-27T07:52:20Z"), model.updatedAt()); - Assertions.assertEquals("gsntnbybkzgcwr", model.serviceBusEndpoint()); - Assertions.assertEquals("lxxwrljdouskc", model.subscriptionId()); - Assertions.assertEquals("kocrcjdkwtnhx", model.scaleUnit()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(false, model.critical()); - Assertions.assertEquals("sqrglssainq", model.dataCenter()); - Assertions.assertEquals(NamespaceType.NOTIFICATION_HUB, model.namespaceType()); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespaceResourceInnerTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespaceResourceInnerTests.java deleted file mode 100644 index 9eeb2bd7ac11..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespaceResourceInnerTests.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.fluent.models.NamespaceResourceInner; -import com.azure.resourcemanager.notificationhubs.models.NamespaceType; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class NamespaceResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NamespaceResourceInner model = BinaryData.fromString( - "{\"properties\":{\"name\":\"lljfmppeeb\",\"provisioningState\":\"gxsabkyq\",\"region\":\"ujitcjcz\",\"metricId\":\"evndh\",\"status\":\"wpdappdsbdkv\",\"createdAt\":\"2021-04-24T00:01:09Z\",\"updatedAt\":\"2021-01-30T07:52:01Z\",\"serviceBusEndpoint\":\"usnhutje\",\"subscriptionId\":\"mrldhu\",\"scaleUnit\":\"zzd\",\"enabled\":true,\"critical\":false,\"dataCenter\":\"cdgea\",\"namespaceType\":\"NotificationHub\"},\"sku\":{\"name\":\"Free\",\"tier\":\"ti\",\"size\":\"dvkaozw\",\"family\":\"ftyhxhurokf\",\"capacity\":1369496360},\"location\":\"olniwpwcukjf\",\"tags\":{\"plwckbas\":\"awxklr\",\"cph\":\"ypnddhsgcb\"},\"id\":\"jkot\",\"name\":\"nqgoulzndli\",\"type\":\"wyqkgfgibm\"}") - .toObject(NamespaceResourceInner.class); - Assertions.assertEquals("olniwpwcukjf", model.location()); - Assertions.assertEquals("awxklr", model.tags().get("plwckbas")); - Assertions.assertEquals(SkuName.FREE, model.sku().name()); - Assertions.assertEquals("ti", model.sku().tier()); - Assertions.assertEquals("dvkaozw", model.sku().size()); - Assertions.assertEquals("ftyhxhurokf", model.sku().family()); - Assertions.assertEquals(1369496360, model.sku().capacity()); - Assertions.assertEquals("lljfmppeeb", model.namePropertiesName()); - Assertions.assertEquals("gxsabkyq", model.provisioningState()); - Assertions.assertEquals("ujitcjcz", model.region()); - Assertions.assertEquals("wpdappdsbdkv", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-24T00:01:09Z"), model.createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-30T07:52:01Z"), model.updatedAt()); - Assertions.assertEquals("usnhutje", model.serviceBusEndpoint()); - Assertions.assertEquals("mrldhu", model.subscriptionId()); - Assertions.assertEquals("zzd", model.scaleUnit()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(false, model.critical()); - Assertions.assertEquals("cdgea", model.dataCenter()); - Assertions.assertEquals(NamespaceType.NOTIFICATION_HUB, model.namespaceType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NamespaceResourceInner model = new NamespaceResourceInner().withLocation("olniwpwcukjf") - .withTags(mapOf("plwckbas", "awxklr", "cph", "ypnddhsgcb")) - .withSku(new Sku().withName(SkuName.FREE) - .withTier("ti") - .withSize("dvkaozw") - .withFamily("ftyhxhurokf") - .withCapacity(1369496360)) - .withNamePropertiesName("lljfmppeeb") - .withProvisioningState("gxsabkyq") - .withRegion("ujitcjcz") - .withStatus("wpdappdsbdkv") - .withCreatedAt(OffsetDateTime.parse("2021-04-24T00:01:09Z")) - .withUpdatedAt(OffsetDateTime.parse("2021-01-30T07:52:01Z")) - .withServiceBusEndpoint("usnhutje") - .withSubscriptionId("mrldhu") - .withScaleUnit("zzd") - .withEnabled(true) - .withCritical(false) - .withDataCenter("cdgea") - .withNamespaceType(NamespaceType.NOTIFICATION_HUB); - model = BinaryData.fromObject(model).toObject(NamespaceResourceInner.class); - Assertions.assertEquals("olniwpwcukjf", model.location()); - Assertions.assertEquals("awxklr", model.tags().get("plwckbas")); - Assertions.assertEquals(SkuName.FREE, model.sku().name()); - Assertions.assertEquals("ti", model.sku().tier()); - Assertions.assertEquals("dvkaozw", model.sku().size()); - Assertions.assertEquals("ftyhxhurokf", model.sku().family()); - Assertions.assertEquals(1369496360, model.sku().capacity()); - Assertions.assertEquals("lljfmppeeb", model.namePropertiesName()); - Assertions.assertEquals("gxsabkyq", model.provisioningState()); - Assertions.assertEquals("ujitcjcz", model.region()); - Assertions.assertEquals("wpdappdsbdkv", model.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-24T00:01:09Z"), model.createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-30T07:52:01Z"), model.updatedAt()); - Assertions.assertEquals("usnhutje", model.serviceBusEndpoint()); - Assertions.assertEquals("mrldhu", model.subscriptionId()); - Assertions.assertEquals("zzd", model.scaleUnit()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(false, model.critical()); - Assertions.assertEquals("cdgea", model.dataCenter()); - Assertions.assertEquals(NamespaceType.NOTIFICATION_HUB, model.namespaceType()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCheckAvailabilityWithResponseMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCheckAvailabilityWithResponseMockTests.java deleted file mode 100644 index d615bd514f21..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCheckAvailabilityWithResponseMockTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityResult; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NamespacesCheckAvailabilityWithResponseMockTests { - @Test - public void testCheckAvailabilityWithResponse() throws Exception { - String responseStr - = "{\"isAvailiable\":true,\"sku\":{\"name\":\"Free\",\"tier\":\"pfhyhl\",\"size\":\"pmopjmc\",\"family\":\"tuo\",\"capacity\":607140678},\"location\":\"fu\",\"tags\":{\"zydagfuaxbezyiuo\":\"odsfcpkvxodpuozm\",\"dxwzywqsmbsurexi\":\"ktwh\",\"yocf\":\"o\"},\"id\":\"fksymddystki\",\"name\":\"uxh\",\"type\":\"yudxorrqnbp\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CheckAvailabilityResult response = manager.namespaces() - .checkAvailabilityWithResponse(new CheckAvailabilityParameters().withName("amdecte") - .withLocation("zrkgqhcjrefovg") - .withTags(mapOf("yvxyqjp", "sle")) - .withSku(new Sku().withName(SkuName.FREE) - .withTier("tpngjcrcczsqpjh") - .withSize("daj") - .withFamily("ysou") - .withCapacity(104525492)) - .withIsAvailiable(false), com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("fu", response.location()); - Assertions.assertEquals("odsfcpkvxodpuozm", response.tags().get("zydagfuaxbezyiuo")); - Assertions.assertEquals(true, response.isAvailiable()); - Assertions.assertEquals(SkuName.FREE, response.sku().name()); - Assertions.assertEquals("pfhyhl", response.sku().tier()); - Assertions.assertEquals("pmopjmc", response.sku().size()); - Assertions.assertEquals("tuo", response.sku().family()); - Assertions.assertEquals(607140678, response.sku().capacity()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCreateOrUpdateWithResponseMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 56530904317d..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import com.azure.resourcemanager.notificationhubs.models.NamespaceResource; -import com.azure.resourcemanager.notificationhubs.models.NamespaceType; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NamespacesCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"name\":\"kfrlhrxsbky\",\"provisioningState\":\"ycanuzbpzkafku\",\"region\":\"crnwbmeh\",\"metricId\":\"eyvjusrtslhspkde\",\"status\":\"aofmxagkvtme\",\"createdAt\":\"2020-12-28T20:08:12Z\",\"updatedAt\":\"2021-06-04T11:35:51Z\",\"serviceBusEndpoint\":\"hvljuahaquh\",\"subscriptionId\":\"hmdua\",\"scaleUnit\":\"exq\",\"enabled\":false,\"critical\":true,\"dataCenter\":\"ws\",\"namespaceType\":\"Messaging\"},\"sku\":{\"name\":\"Free\",\"tier\":\"pv\",\"size\":\"mzlfmisgwb\",\"family\":\"beldawkzbaliourq\",\"capacity\":997736872},\"location\":\"auhashsfwx\",\"tags\":{\"xcug\":\"w\",\"ovbvmeueciv\":\"cjooxdjebwpucwwf\"},\"id\":\"hzceuojgjrwjue\",\"name\":\"otwmcdyt\",\"type\":\"x\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - NamespaceResource response = manager.namespaces() - .define("yqupedeojnabckh") - .withLocation("uyonobglaoc") - .withExistingResourceGroup("m") - .withTags(mapOf("yudxytlmoy", "ccm")) - .withSku(new Sku().withName(SkuName.FREE) - .withTier("uscrpabgyepsb") - .withSize("azqugxywpmueefj") - .withFamily("fqkquj") - .withCapacity(1148622887)) - .withNamePropertiesName("xpsiebtfhvpes") - .withProvisioningState("skrdqmhjj") - .withRegion("tldwkyzxuutk") - .withStatus("svlxotogtwrup") - .withCreatedAt(OffsetDateTime.parse("2021-08-21T23:24:20Z")) - .withUpdatedAt(OffsetDateTime.parse("2021-05-04T00:58:15Z")) - .withServiceBusEndpoint("i") - .withSubscriptionId("kvceoveilovnotyf") - .withScaleUnit("cnjbkcnxdhbt") - .withEnabled(false) - .withCritical(false) - .withDataCenter("pnvjtoqnermclf") - .withNamespaceType(NamespaceType.MESSAGING) - .create(); - - Assertions.assertEquals("auhashsfwx", response.location()); - Assertions.assertEquals("w", response.tags().get("xcug")); - Assertions.assertEquals(SkuName.FREE, response.sku().name()); - Assertions.assertEquals("pv", response.sku().tier()); - Assertions.assertEquals("mzlfmisgwb", response.sku().size()); - Assertions.assertEquals("beldawkzbaliourq", response.sku().family()); - Assertions.assertEquals(997736872, response.sku().capacity()); - Assertions.assertEquals("kfrlhrxsbky", response.namePropertiesName()); - Assertions.assertEquals("ycanuzbpzkafku", response.provisioningState()); - Assertions.assertEquals("crnwbmeh", response.region()); - Assertions.assertEquals("aofmxagkvtme", response.status()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-28T20:08:12Z"), response.createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-04T11:35:51Z"), response.updatedAt()); - Assertions.assertEquals("hvljuahaquh", response.serviceBusEndpoint()); - Assertions.assertEquals("hmdua", response.subscriptionId()); - Assertions.assertEquals("exq", response.scaleUnit()); - Assertions.assertEquals(false, response.enabled()); - Assertions.assertEquals(true, response.critical()); - Assertions.assertEquals("ws", response.dataCenter()); - Assertions.assertEquals(NamespaceType.MESSAGING, response.namespaceType()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteAuthorizationRuleWithResponseMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteAuthorizationRuleWithResponseMockTests.java deleted file mode 100644 index af8c5ce2cdc3..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteAuthorizationRuleWithResponseMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NamespacesDeleteAuthorizationRuleWithResponseMockTests { - @Test - public void testDeleteAuthorizationRuleWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.namespaces() - .deleteAuthorizationRuleWithResponse("yxoegukgjnp", "ucgygevqz", "typmrbpizcdrqjsd", - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteMockTests.java deleted file mode 100644 index a36570815241..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesDeleteMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NamespacesDeleteMockTests { - @Test - public void testDelete() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.namespaces().delete("czvyifq", "vkd", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesGetByResourceGroupWithResponseMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesGetByResourceGroupWithResponseMockTests.java deleted file mode 100644 index ec05078870d2..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import com.azure.resourcemanager.notificationhubs.models.NamespaceResource; -import com.azure.resourcemanager.notificationhubs.models.NamespaceType; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NamespacesGetByResourceGroupWithResponseMockTests { - @Test - public void testGetByResourceGroupWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"name\":\"t\",\"provisioningState\":\"n\",\"region\":\"lexxbczwtru\",\"metricId\":\"qzbqjvsov\",\"status\":\"okacspk\",\"createdAt\":\"2021-04-15T03:02:29Z\",\"updatedAt\":\"2021-04-27T23:18:31Z\",\"serviceBusEndpoint\":\"bpxjmfl\",\"subscriptionId\":\"vnchrkcci\",\"scaleUnit\":\"zjuqkhrsaj\",\"enabled\":false,\"critical\":false,\"dataCenter\":\"oskg\",\"namespaceType\":\"Messaging\"},\"sku\":{\"name\":\"Standard\",\"tier\":\"mjmvxieduugidyjr\",\"size\":\"byao\",\"family\":\"e\",\"capacity\":981492544},\"location\":\"onpc\",\"tags\":{\"eggzfb\":\"cohslkev\",\"ithlvmezyvshxm\":\"hfmvfaxkffe\",\"gigr\":\"sbbzo\"},\"id\":\"wburvjxxjnspydpt\",\"name\":\"oenkouknvudwti\",\"type\":\"kbldngkpocipa\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - NamespaceResource response = manager.namespaces() - .getByResourceGroupWithResponse("jsllrmv", "d", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("onpc", response.location()); - Assertions.assertEquals("cohslkev", response.tags().get("eggzfb")); - Assertions.assertEquals(SkuName.STANDARD, response.sku().name()); - Assertions.assertEquals("mjmvxieduugidyjr", response.sku().tier()); - Assertions.assertEquals("byao", response.sku().size()); - Assertions.assertEquals("e", response.sku().family()); - Assertions.assertEquals(981492544, response.sku().capacity()); - Assertions.assertEquals("t", response.namePropertiesName()); - Assertions.assertEquals("n", response.provisioningState()); - Assertions.assertEquals("lexxbczwtru", response.region()); - Assertions.assertEquals("okacspk", response.status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-15T03:02:29Z"), response.createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-27T23:18:31Z"), response.updatedAt()); - Assertions.assertEquals("bpxjmfl", response.serviceBusEndpoint()); - Assertions.assertEquals("vnchrkcci", response.subscriptionId()); - Assertions.assertEquals("zjuqkhrsaj", response.scaleUnit()); - Assertions.assertEquals(false, response.enabled()); - Assertions.assertEquals(false, response.critical()); - Assertions.assertEquals("oskg", response.dataCenter()); - Assertions.assertEquals(NamespaceType.MESSAGING, response.namespaceType()); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListByResourceGroupMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListByResourceGroupMockTests.java deleted file mode 100644 index 498bdfd17b0f..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListByResourceGroupMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import com.azure.resourcemanager.notificationhubs.models.NamespaceResource; -import com.azure.resourcemanager.notificationhubs.models.NamespaceType; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NamespacesListByResourceGroupMockTests { - @Test - public void testListByResourceGroup() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"name\":\"gshwankixz\",\"provisioningState\":\"njeputtmrywn\",\"region\":\"oqftiyqzrnkcq\",\"metricId\":\"xlwhzlsicoh\",\"status\":\"qnwvlrya\",\"createdAt\":\"2021-12-07T06:57Z\",\"updatedAt\":\"2021-11-18T07:56:25Z\",\"serviceBusEndpoint\":\"nmmqhgyxzkon\",\"subscriptionId\":\"uko\",\"scaleUnit\":\"yaxuconuqszfkb\",\"enabled\":false,\"critical\":true,\"dataCenter\":\"mjmwvvjektcx\",\"namespaceType\":\"NotificationHub\"},\"sku\":{\"name\":\"Standard\",\"tier\":\"rsffrzpwvlqdqgbi\",\"size\":\"lihkaetcktvfc\",\"family\":\"fsnkymuctq\",\"capacity\":361988947},\"location\":\"bebrjcxerfuwuttt\",\"tags\":{\"hfnljkyq\":\"jrbirphxepcyv\",\"uujqgidokgjljyo\":\"j\",\"bgsncghkjeszzhb\":\"gvcl\",\"mpvecxgodebfqk\":\"jhtxfvgxbfsmxne\"},\"id\":\"rbmpukgri\",\"name\":\"flz\",\"type\":\"fbxzpuzycisp\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.namespaces().listByResourceGroup("pbuxwgipwhon", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("bebrjcxerfuwuttt", response.iterator().next().location()); - Assertions.assertEquals("jrbirphxepcyv", response.iterator().next().tags().get("hfnljkyq")); - Assertions.assertEquals(SkuName.STANDARD, response.iterator().next().sku().name()); - Assertions.assertEquals("rsffrzpwvlqdqgbi", response.iterator().next().sku().tier()); - Assertions.assertEquals("lihkaetcktvfc", response.iterator().next().sku().size()); - Assertions.assertEquals("fsnkymuctq", response.iterator().next().sku().family()); - Assertions.assertEquals(361988947, response.iterator().next().sku().capacity()); - Assertions.assertEquals("gshwankixz", response.iterator().next().namePropertiesName()); - Assertions.assertEquals("njeputtmrywn", response.iterator().next().provisioningState()); - Assertions.assertEquals("oqftiyqzrnkcq", response.iterator().next().region()); - Assertions.assertEquals("qnwvlrya", response.iterator().next().status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-12-07T06:57Z"), response.iterator().next().createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-18T07:56:25Z"), response.iterator().next().updatedAt()); - Assertions.assertEquals("nmmqhgyxzkon", response.iterator().next().serviceBusEndpoint()); - Assertions.assertEquals("uko", response.iterator().next().subscriptionId()); - Assertions.assertEquals("yaxuconuqszfkb", response.iterator().next().scaleUnit()); - Assertions.assertEquals(false, response.iterator().next().enabled()); - Assertions.assertEquals(true, response.iterator().next().critical()); - Assertions.assertEquals("mjmwvvjektcx", response.iterator().next().dataCenter()); - Assertions.assertEquals(NamespaceType.NOTIFICATION_HUB, response.iterator().next().namespaceType()); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListMockTests.java deleted file mode 100644 index 27fbbe801727..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NamespacesListMockTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import com.azure.resourcemanager.notificationhubs.models.NamespaceResource; -import com.azure.resourcemanager.notificationhubs.models.NamespaceType; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NamespacesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"name\":\"ahmgkbrp\",\"provisioningState\":\"dhibnuq\",\"region\":\"pikad\",\"metricId\":\"vtq\",\"status\":\"n\",\"createdAt\":\"2021-11-05T12:10:44Z\",\"updatedAt\":\"2021-04-18T08:45:47Z\",\"serviceBusEndpoint\":\"jggmebfsiarbu\",\"subscriptionId\":\"cvpnazzmhjrunmpx\",\"scaleUnit\":\"dbhrbnlankxm\",\"enabled\":false,\"critical\":true,\"dataCenter\":\"enbtkcxywny\",\"namespaceType\":\"Messaging\"},\"sku\":{\"name\":\"Basic\",\"tier\":\"lqidyby\",\"size\":\"zfcl\",\"family\":\"axdbabph\",\"capacity\":2118768153},\"location\":\"qlfktsths\",\"tags\":{\"wwrq\":\"cmnyyazttb\",\"ywbiexzfeyueax\":\"uedck\",\"wbhqwal\":\"bxu\",\"kzjancuxrhdwbav\":\"uzyoxaep\"},\"id\":\"bniwdj\",\"name\":\"wz\",\"type\":\"s\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.namespaces().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("qlfktsths", response.iterator().next().location()); - Assertions.assertEquals("cmnyyazttb", response.iterator().next().tags().get("wwrq")); - Assertions.assertEquals(SkuName.BASIC, response.iterator().next().sku().name()); - Assertions.assertEquals("lqidyby", response.iterator().next().sku().tier()); - Assertions.assertEquals("zfcl", response.iterator().next().sku().size()); - Assertions.assertEquals("axdbabph", response.iterator().next().sku().family()); - Assertions.assertEquals(2118768153, response.iterator().next().sku().capacity()); - Assertions.assertEquals("ahmgkbrp", response.iterator().next().namePropertiesName()); - Assertions.assertEquals("dhibnuq", response.iterator().next().provisioningState()); - Assertions.assertEquals("pikad", response.iterator().next().region()); - Assertions.assertEquals("n", response.iterator().next().status()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-05T12:10:44Z"), response.iterator().next().createdAt()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-18T08:45:47Z"), response.iterator().next().updatedAt()); - Assertions.assertEquals("jggmebfsiarbu", response.iterator().next().serviceBusEndpoint()); - Assertions.assertEquals("cvpnazzmhjrunmpx", response.iterator().next().subscriptionId()); - Assertions.assertEquals("dbhrbnlankxm", response.iterator().next().scaleUnit()); - Assertions.assertEquals(false, response.iterator().next().enabled()); - Assertions.assertEquals(true, response.iterator().next().critical()); - Assertions.assertEquals("enbtkcxywny", response.iterator().next().dataCenter()); - Assertions.assertEquals(NamespaceType.MESSAGING, response.iterator().next().namespaceType()); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCheckNotificationHubAvailabilityWithResponseMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCheckNotificationHubAvailabilityWithResponseMockTests.java deleted file mode 100644 index 6a0e06efa301..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsCheckNotificationHubAvailabilityWithResponseMockTests.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityParameters; -import com.azure.resourcemanager.notificationhubs.models.CheckAvailabilityResult; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NotificationHubsCheckNotificationHubAvailabilityWithResponseMockTests { - @Test - public void testCheckNotificationHubAvailabilityWithResponse() throws Exception { - String responseStr - = "{\"isAvailiable\":false,\"sku\":{\"name\":\"Standard\",\"tier\":\"bexrmcq\",\"size\":\"ycnojvknmefqsg\",\"family\":\"ah\",\"capacity\":2048055130},\"location\":\"y\",\"tags\":{\"zlmwlxkvugfhz\":\"vgqzcjrvxd\",\"hnnpr\":\"vawjvzunlu\",\"ultskzbbtdz\":\"xipeilpjzuaejx\",\"ekg\":\"mv\"},\"id\":\"wozuhkf\",\"name\":\"bsjyofdx\",\"type\":\"uusdttouwa\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CheckAvailabilityResult response = manager.notificationHubs() - .checkNotificationHubAvailabilityWithResponse("btdhxujznbm", "ow", - new CheckAvailabilityParameters().withName("lupj") - .withLocation("plrbpbewtghf") - .withTags(mapOf("wxzvlvqhjkb", "c", "iebwwaloayqcgwrt", "gibtnm", "zg", "j")) - .withSku(new Sku().withName(SkuName.BASIC) - .withTier("htxongmtsavjc") - .withSize("wxqpsrknftguvri") - .withFamily("prwmdyvxqt") - .withCapacity(1831574988)) - .withIsAvailiable(false), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("y", response.location()); - Assertions.assertEquals("vgqzcjrvxd", response.tags().get("zlmwlxkvugfhz")); - Assertions.assertEquals(false, response.isAvailiable()); - Assertions.assertEquals(SkuName.STANDARD, response.sku().name()); - Assertions.assertEquals("bexrmcq", response.sku().tier()); - Assertions.assertEquals("ycnojvknmefqsg", response.sku().size()); - Assertions.assertEquals("ah", response.sku().family()); - Assertions.assertEquals(2048055130, response.sku().capacity()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDebugSendWithResponseMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDebugSendWithResponseMockTests.java deleted file mode 100644 index b2ea20801691..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDebugSendWithResponseMockTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import com.azure.resourcemanager.notificationhubs.models.DebugSendResponse; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NotificationHubsDebugSendWithResponseMockTests { - @Test - public void testDebugSendWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"success\":45.423527,\"failure\":32.826424,\"results\":\"datatfdygpfqb\"},\"sku\":{\"name\":\"Basic\",\"tier\":\"op\",\"size\":\"qrhhu\",\"family\":\"pppcqeqxo\",\"capacity\":280761286},\"location\":\"ahzxctobgbk\",\"tags\":{\"grcfb\":\"izpost\",\"bpvjymjhx\":\"nrmfqjhhk\",\"n\":\"j\",\"ivkrtsw\":\"u\"},\"id\":\"xqzvszjfa\",\"name\":\"vjfdx\",\"type\":\"ivetvtcq\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 201, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DebugSendResponse response = manager.notificationHubs() - .debugSendWithResponse("gylgqgitxmedjvcs", "ynqwwncwzzhxgk", "rmgucnap", "datat", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("ahzxctobgbk", response.location()); - Assertions.assertEquals("izpost", response.tags().get("grcfb")); - Assertions.assertEquals(SkuName.BASIC, response.sku().name()); - Assertions.assertEquals("op", response.sku().tier()); - Assertions.assertEquals("qrhhu", response.sku().size()); - Assertions.assertEquals("pppcqeqxo", response.sku().family()); - Assertions.assertEquals(280761286, response.sku().capacity()); - Assertions.assertEquals(45.423527F, response.success()); - Assertions.assertEquals(32.826424F, response.failure()); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteAuthorizationRuleWithResponseMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteAuthorizationRuleWithResponseMockTests.java deleted file mode 100644 index 2b19c64c6fcc..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteAuthorizationRuleWithResponseMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NotificationHubsDeleteAuthorizationRuleWithResponseMockTests { - @Test - public void testDeleteAuthorizationRuleWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.notificationHubs() - .deleteAuthorizationRuleWithResponse("vshqjohxcr", "bfovasrruvwbhsq", "sub", "gjb", - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteWithResponseMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteWithResponseMockTests.java deleted file mode 100644 index 454db3e7e7e2..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/NotificationHubsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class NotificationHubsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.notificationHubs().deleteWithResponse("oekqvk", "lns", "vbxwyjsflhh", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationDisplayTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationDisplayTests.java deleted file mode 100644 index fcb7d0c122f7..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationDisplayTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.models.OperationDisplay; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = BinaryData - .fromString("{\"provider\":\"psqucmpoyf\",\"resource\":\"fogknygjofjdde\",\"operation\":\"rd\"}") - .toObject(OperationDisplay.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationInnerTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationInnerTests.java deleted file mode 100644 index 32833a63b929..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationInnerTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.fluent.models.OperationInner; -import com.azure.resourcemanager.notificationhubs.models.OperationDisplay; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = BinaryData.fromString( - "{\"name\":\"esaagdfm\",\"display\":{\"provider\":\"lhjxr\",\"resource\":\"kwm\",\"operation\":\"ktsizntocipaou\"}}") - .toObject(OperationInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationListResultTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationListResultTests.java deleted file mode 100644 index aa96dcfb52a6..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.models.OperationListResult; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = BinaryData.fromString( - "{\"value\":[{\"name\":\"quvgjxpybczme\",\"display\":{\"provider\":\"zopbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\"}},{\"name\":\"zehtbmu\",\"display\":{\"provider\":\"wnoi\",\"resource\":\"wlrxyb\",\"operation\":\"oqijgkdmbpaz\"}},{\"name\":\"bc\",\"display\":{\"provider\":\"dznrbtcqq\",\"resource\":\"qglhq\",\"operation\":\"ufo\"}}],\"nextLink\":\"jywif\"}") - .toObject(OperationListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationsListMockTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationsListMockTests.java index d3c2c03dc252..002737365421 100644 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationsListMockTests.java +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/OperationsListMockTests.java @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.notificationhubs.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.notificationhubs.NotificationHubsManager; +import com.azure.resourcemanager.notificationhubs.NotificationhubsManager; import com.azure.resourcemanager.notificationhubs.models.Operation; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -21,14 +21,14 @@ public final class OperationsListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"name\":\"jjugwdkcglhslaz\",\"display\":{\"provider\":\"ggd\",\"resource\":\"ixhbkuofqweykhm\",\"operation\":\"evfyexfwhybcib\"}}]}"; + = "{\"value\":[{\"name\":\"vetvt\",\"display\":{\"provider\":\"qtdo\",\"resource\":\"cbxvwvxyslqbh\",\"operation\":\"xoblytkbl\",\"description\":\"ewwwfbkrvrnsv\"},\"isDataAction\":false,\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{\"name\":\"rsbfovasrruvw\",\"displayName\":\"sqfsubcgjbirxb\",\"blobDuration\":\"bsrfbj\",\"categoryGroups\":[\"w\"]}],\"metricSpecifications\":[{\"name\":\"ftpvjzbexil\",\"displayName\":\"nfqqnvwp\",\"displayDescription\":\"taruoujmkcj\",\"unit\":\"qytjrybnwjewgd\",\"aggregationType\":\"ervnaenqpehi\",\"availabilities\":[{},{}],\"supportedTimeGrainTypes\":[\"mifthnzdnd\",\"l\",\"nayqi\"],\"metricFilterPattern\":\"nduhavhqlkthum\",\"fillGapWithZero\":true},{\"name\":\"bgycduiertgccym\",\"displayName\":\"olpsslqlf\",\"displayDescription\":\"dnbbglzps\",\"unit\":\"ydmcwyhzdxssa\",\"aggregationType\":\"zmnvdfznudaod\",\"availabilities\":[{}],\"supportedTimeGrainTypes\":[\"cblylpstdbhhxsr\",\"dzu\",\"erscdntne\"],\"metricFilterPattern\":\"iwjmygtdssls\",\"fillGapWithZero\":true},{\"name\":\"eriofzpyqs\",\"displayName\":\"wab\",\"displayDescription\":\"tshhszhedp\",\"unit\":\"wiwubm\",\"aggregationType\":\"besldnkwwtppjflc\",\"availabilities\":[{},{},{},{}],\"supportedTimeGrainTypes\":[\"konzmnsik\",\"mkqzeqqkdltfzxmh\",\"v\",\"gureodkwobdag\"],\"metricFilterPattern\":\"ibqdxbxwakbogqx\",\"fillGapWithZero\":true},{\"name\":\"zgx\",\"displayName\":\"ripl\",\"displayDescription\":\"odxun\",\"unit\":\"ebxmubyynt\",\"aggregationType\":\"rbqtkoie\",\"availabilities\":[{}],\"supportedTimeGrainTypes\":[\"gqrlltmuwla\"],\"metricFilterPattern\":\"zizxbmpgcj\",\"fillGapWithZero\":false}]}}}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - NotificationHubsManager manager = NotificationHubsManager.configure() + NotificationhubsManager manager = NotificationhubsManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/SkuTests.java b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/SkuTests.java deleted file mode 100644 index 3427188341c9..000000000000 --- a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/test/java/com/azure/resourcemanager/notificationhubs/generated/SkuTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.notificationhubs.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.notificationhubs.models.Sku; -import com.azure.resourcemanager.notificationhubs.models.SkuName; -import org.junit.jupiter.api.Assertions; - -public final class SkuTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Sku model = BinaryData.fromString( - "{\"name\":\"Standard\",\"tier\":\"vg\",\"size\":\"zsymglzufcyzkohd\",\"family\":\"hanufhfcbjysagi\",\"capacity\":1438180551}") - .toObject(Sku.class); - Assertions.assertEquals(SkuName.STANDARD, model.name()); - Assertions.assertEquals("vg", model.tier()); - Assertions.assertEquals("zsymglzufcyzkohd", model.size()); - Assertions.assertEquals("hanufhfcbjysagi", model.family()); - Assertions.assertEquals(1438180551, model.capacity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Sku model = new Sku().withName(SkuName.STANDARD) - .withTier("vg") - .withSize("zsymglzufcyzkohd") - .withFamily("hanufhfcbjysagi") - .withCapacity(1438180551); - model = BinaryData.fromObject(model).toObject(Sku.class); - Assertions.assertEquals(SkuName.STANDARD, model.name()); - Assertions.assertEquals("vg", model.tier()); - Assertions.assertEquals("zsymglzufcyzkohd", model.size()); - Assertions.assertEquals("hanufhfcbjysagi", model.family()); - Assertions.assertEquals(1438180551, model.capacity()); - } -} diff --git a/sdk/notificationhubs/azure-resourcemanager-notificationhubs/tsp-location.yaml b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/tsp-location.yaml new file mode 100644 index 000000000000..88b5b4d67d97 --- /dev/null +++ b/sdk/notificationhubs/azure-resourcemanager-notificationhubs/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/notificationhubs/Notificationhubs.Management +commit: 667754246f5134bee75359ea2cd11a3c3f52d511 +repo: Azure/azure-rest-api-specs +additionalDirectories: