diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 83a1758d6b01..ae7fbd1c16ff 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -320,7 +320,7 @@ com.azure.resourcemanager:azure-resourcemanager-redisenterprise;2.1.0;2.2.0-beta com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0;1.1.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iothub;1.3.0;1.4.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-datadog;1.1.0;1.2.0-beta.1 -com.azure.resourcemanager:azure-resourcemanager-communication;2.2.0;2.3.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-communication;2.2.0;2.3.0 com.azure.resourcemanager:azure-resourcemanager-apimanagement;2.0.0;2.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.1.0;1.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-changeanalysis;1.1.0;1.2.0-beta.1 diff --git a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md index acbe57e074c6..f7de09706b6b 100644 --- a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md +++ b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md @@ -1,14 +1,82 @@ # Release History -## 2.3.0-beta.1 (Unreleased) +## 2.3.0 (2026-01-22) + +- Azure Resource Manager Communication client library for Java. This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-2025-09-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added -### Breaking Changes +* `models.SuppressionListAddressResourceCollection` was added + +* `models.SuppressionListAddressResource` was added + +* `models.SmtpUsernameResource$Update` was added + +* `models.SmtpUsernameResource` was added + +* `models.SmtpUsernameResource$Definition` was added + +* `models.SuppressionListResource$UpdateStages` was added + +* `models.SuppressionListResource$Update` was added + +* `models.PublicNetworkAccess` was added + +* `models.SmtpUsernameResource$UpdateStages` was added + +* `models.SmtpUsernameResourceCollection` was added + +* `models.SuppressionListAddressResource$Update` was added + +* `models.SuppressionListAddressResource$Definition` was added + +* `models.SuppressionListAddresses` was added + +* `models.SuppressionListAddressResource$DefinitionStages` was added + +* `models.SuppressionListResource$Definition` was added + +* `models.SuppressionListResource` was added + +* `models.SuppressionLists` was added + +* `models.SmtpUsernames` was added + +* `models.SuppressionListResourceCollection` was added + +* `models.SuppressionListResource$DefinitionStages` was added + +* `models.SmtpUsernameResource$DefinitionStages` was added + +* `models.SuppressionListAddressResource$UpdateStages` was added + +#### `models.CommunicationServiceResource$Update` was modified -### Bugs Fixed +* `withDisableLocalAuth(java.lang.Boolean)` was added +* `withPublicNetworkAccess(models.PublicNetworkAccess)` was added -### Other Changes +#### `models.CommunicationServiceResource$Definition` was modified + +* `withPublicNetworkAccess(models.PublicNetworkAccess)` was added +* `withDisableLocalAuth(java.lang.Boolean)` was added + +#### `models.CommunicationServiceResourceUpdate` was modified + +* `withDisableLocalAuth(java.lang.Boolean)` was added +* `publicNetworkAccess()` was added +* `disableLocalAuth()` was added +* `withPublicNetworkAccess(models.PublicNetworkAccess)` was added + +#### `models.CommunicationServiceResource` was modified + +* `publicNetworkAccess()` was added +* `disableLocalAuth()` was added + +#### `CommunicationManager` was modified + +* `suppressionListAddresses()` was added +* `suppressionLists()` was added +* `smtpUsernames()` was added ## 2.2.0 (2024-12-19) diff --git a/sdk/communication/azure-resourcemanager-communication/README.md b/sdk/communication/azure-resourcemanager-communication/README.md index 858ec6b5709b..064def553430 100644 --- a/sdk/communication/azure-resourcemanager-communication/README.md +++ b/sdk/communication/azure-resourcemanager-communication/README.md @@ -2,7 +2,7 @@ Azure Resource Manager Communication client library for Java. -This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-2023-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 Communication Management SDK. REST API for Azure Communication Services. Package tag package-2025-09-01. 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 @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-communication - 2.3.0-beta.1 + 2.3.0 ``` [//]: # ({x-version-update-end}) @@ -52,7 +52,7 @@ 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(); @@ -60,7 +60,7 @@ CommunicationManager manager = CommunicationManager .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/communication/azure-resourcemanager-communication/SAMPLE.md b/sdk/communication/azure-resourcemanager-communication/SAMPLE.md index 64998b7f73e6..03395273747d 100644 --- a/sdk/communication/azure-resourcemanager-communication/SAMPLE.md +++ b/sdk/communication/azure-resourcemanager-communication/SAMPLE.md @@ -44,6 +44,27 @@ - [Delete](#senderusernames_delete) - [Get](#senderusernames_get) - [ListByDomains](#senderusernames_listbydomains) + +## SmtpUsernames + +- [CreateOrUpdate](#smtpusernames_createorupdate) +- [Delete](#smtpusernames_delete) +- [Get](#smtpusernames_get) +- [List](#smtpusernames_list) + +## SuppressionListAddresses + +- [CreateOrUpdate](#suppressionlistaddresses_createorupdate) +- [Delete](#suppressionlistaddresses_delete) +- [Get](#suppressionlistaddresses_get) +- [List](#suppressionlistaddresses_list) + +## SuppressionLists + +- [CreateOrUpdate](#suppressionlists_createorupdate) +- [Delete](#suppressionlists_delete) +- [Get](#suppressionlists_get) +- [ListByDomain](#suppressionlists_listbydomain) ### CommunicationServices_CheckNameAvailability ```java @@ -55,7 +76,7 @@ import com.azure.resourcemanager.communication.models.NameAvailabilityParameters public final class CommunicationServicesCheckNameAvailabilitySamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/checkNameAvailabilityAvailable.json */ /** @@ -72,7 +93,7 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/checkNameAvailabilityUnavailable.json */ /** @@ -94,6 +115,7 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { ```java import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; /** * Samples for CommunicationServices CreateOrUpdate. @@ -101,7 +123,7 @@ import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType public final class CommunicationServicesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/createOrUpdate.json */ /** @@ -120,7 +142,28 @@ public final class CommunicationServicesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ + * communicationServices/createOrUpdateWithPublicNetworkAccess.json + */ + /** + * Sample code: Create or update resource with PublicNetworkAccess. + * + * @param manager Entry point to CommunicationManager. + */ + public static void createOrUpdateResourceWithPublicNetworkAccess( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withDataLocation("United States") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .create(); + } + + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/createOrUpdateWithSystemAssignedIdentity.json */ /** @@ -138,6 +181,27 @@ public final class CommunicationServicesCreateOrUpdateSamples { .withDataLocation("United States") .create(); } + + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ + * communicationServices/createOrUpdateWithDisableLocalAuth.json + */ + /** + * Sample code: Create or update resource with DisableLocalAuth. + * + * @param manager Entry point to CommunicationManager. + */ + public static void createOrUpdateResourceWithDisableLocalAuth( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withDataLocation("United States") + .withDisableLocalAuth(true) + .create(); + } } ``` @@ -150,7 +214,7 @@ public final class CommunicationServicesCreateOrUpdateSamples { public final class CommunicationServicesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/delete.json */ /** @@ -174,7 +238,7 @@ public final class CommunicationServicesDeleteSamples { public final class CommunicationServicesGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/get.json */ /** @@ -201,7 +265,7 @@ import com.azure.resourcemanager.communication.models.LinkNotificationHubParamet public final class CommunicationServicesLinkNotificationHubSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/linkNotificationHub.json */ /** @@ -229,7 +293,7 @@ public final class CommunicationServicesLinkNotificationHubSamples { public final class CommunicationServicesListSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/listBySubscription.json */ /** @@ -252,7 +316,7 @@ public final class CommunicationServicesListSamples { public final class CommunicationServicesListByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/listByResourceGroup.json */ /** @@ -275,7 +339,7 @@ public final class CommunicationServicesListByResourceGroupSamples { public final class CommunicationServicesListKeysSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/listKeys.json */ /** @@ -302,7 +366,7 @@ import com.azure.resourcemanager.communication.models.RegenerateKeyParameters; public final class CommunicationServicesRegenerateKeySamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/regenerateKey.json */ /** @@ -324,6 +388,7 @@ public final class CommunicationServicesRegenerateKeySamples { import com.azure.resourcemanager.communication.models.CommunicationServiceResource; import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.HashMap; import java.util.Map; @@ -334,7 +399,7 @@ import java.util.Map; public final class CommunicationServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/update.json */ /** @@ -352,7 +417,7 @@ public final class CommunicationServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/updateWithUserAssignedIdentity.json */ /** @@ -375,7 +440,48 @@ public final class CommunicationServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ + * communicationServices/updateWithPublicNetworkAccess.json + */ + /** + * Sample code: Update resource to add PublicNetworkAccess. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + updateResourceToAddPublicNetworkAccess(com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .apply(); + } + + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ + * communicationServices/updateWithDisableLocalAuth.json + */ + /** + * Sample code: Update resource to add DisableLocalAuth. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + updateResourceToAddDisableLocalAuth(com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("newTag", "newVal")).withDisableLocalAuth(true).apply(); + } + + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/updateWithSystemAssignedIdentity.json */ /** @@ -397,7 +503,7 @@ public final class CommunicationServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/updateRemoveSystemIdentity.json */ /** @@ -419,7 +525,7 @@ public final class CommunicationServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/updateWithSystemAndUserIdentity.json */ /** @@ -467,7 +573,7 @@ import com.azure.resourcemanager.communication.models.VerificationType; public final class DomainsCancelVerificationSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/ * cancelVerification.json */ /** @@ -495,7 +601,7 @@ import com.azure.resourcemanager.communication.models.DomainManagement; public final class DomainsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/ * createOrUpdate.json */ /** @@ -524,7 +630,7 @@ public final class DomainsCreateOrUpdateSamples { public final class DomainsDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/delete. + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/delete. * json */ /** @@ -548,7 +654,7 @@ public final class DomainsDeleteSamples { public final class DomainsGetSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/get.json + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/get.json */ /** * Sample code: Get Domains resource. @@ -575,7 +681,7 @@ import com.azure.resourcemanager.communication.models.VerificationType; public final class DomainsInitiateVerificationSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/ * initiateVerification.json */ /** @@ -601,7 +707,7 @@ public final class DomainsInitiateVerificationSamples { public final class DomainsListByEmailServiceResourceSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/ * listByEmailService.json */ /** @@ -629,7 +735,7 @@ import com.azure.resourcemanager.communication.models.UserEngagementTracking; public final class DomainsUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/update. + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/update. * json */ /** @@ -656,7 +762,7 @@ public final class DomainsUpdateSamples { public final class EmailServicesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * createOrUpdate.json */ /** @@ -685,7 +791,7 @@ public final class EmailServicesCreateOrUpdateSamples { public final class EmailServicesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * delete.json */ /** @@ -709,7 +815,7 @@ public final class EmailServicesDeleteSamples { public final class EmailServicesGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/get + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/get * .json */ /** @@ -734,7 +840,7 @@ public final class EmailServicesGetByResourceGroupSamples { public final class EmailServicesListSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * listBySubscription.json */ /** @@ -758,7 +864,7 @@ public final class EmailServicesListSamples { public final class EmailServicesListByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * listByResourceGroup.json */ /** @@ -782,7 +888,7 @@ public final class EmailServicesListByResourceGroupSamples { public final class EmailServicesListVerifiedExchangeOnlineDomainsSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * getVerifiedExchangeOnlineDomains.json */ /** @@ -810,7 +916,7 @@ import java.util.Map; public final class EmailServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * update.json */ /** @@ -850,7 +956,7 @@ public final class EmailServicesUpdateSamples { public final class OperationsListSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/operationsList.json */ /** @@ -873,7 +979,7 @@ public final class OperationsListSamples { public final class SenderUsernamesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/senderUsernames/ * createOrUpdate.json */ /** @@ -902,7 +1008,7 @@ public final class SenderUsernamesCreateOrUpdateSamples { public final class SenderUsernamesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/senderUsernames/ * delete.json */ /** @@ -928,7 +1034,7 @@ public final class SenderUsernamesDeleteSamples { public final class SenderUsernamesGetSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/senderUsernames/ * get.json */ /** @@ -954,7 +1060,7 @@ public final class SenderUsernamesGetSamples { public final class SenderUsernamesListByDomainsSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/senderUsernames/ * listByDomain.json */ /** @@ -971,3 +1077,324 @@ public final class SenderUsernamesListByDomainsSamples { } ``` +### SmtpUsernames_CreateOrUpdate + +```java +/** + * Samples for SmtpUsernames CreateOrUpdate. + */ +public final class SmtpUsernamesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/smtpUsername/ + * createOrUpdate.json + */ + /** + * Sample code: CreateOrUpdate SmtpUsername resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + createOrUpdateSmtpUsernameResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.smtpUsernames() + .define("smtpusername1") + .withExistingCommunicationService("contosoResourceGroup", "contosoACSService") + .withUsername("newuser1@contoso.com") + .withEntraApplicationId("aaaa1111-bbbb-2222-3333-aaaa111122bb") + .withTenantId("aaaa1111-bbbb-2222-3333-aaaa11112222") + .create(); + } +} +``` + +### SmtpUsernames_Delete + +```java +/** + * Samples for SmtpUsernames Delete. + */ +public final class SmtpUsernamesDeleteSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/smtpUsername/ + * delete.json + */ + /** + * Sample code: Delete a SmtpUsername resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + deleteASmtpUsernameResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.smtpUsernames() + .deleteWithResponse("MyResourceGroup", "contosoACSService", "smtpusername1", + com.azure.core.util.Context.NONE); + } +} +``` + +### SmtpUsernames_Get + +```java +/** + * Samples for SmtpUsernames Get. + */ +public final class SmtpUsernamesGetSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/smtpUsername/get. + * json + */ + /** + * Sample code: Get a SmtpUsername resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void getASmtpUsernameResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.smtpUsernames() + .getWithResponse("contosoResourceGroup", "contosoACSService", "smtpusername1", + com.azure.core.util.Context.NONE); + } +} +``` + +### SmtpUsernames_List + +```java +/** + * Samples for SmtpUsernames List. + */ +public final class SmtpUsernamesListSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/smtpUsername/ + * getAll.json + */ + /** + * Sample code: Get all SmtpUsername resources for a CommunicationService resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void getAllSmtpUsernameResourcesForACommunicationServiceResource( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.smtpUsernames().list("contosoResourceGroup", "contosoACSService", com.azure.core.util.Context.NONE); + } +} +``` + +### SuppressionListAddresses_CreateOrUpdate + +```java +/** + * Samples for SuppressionListAddresses CreateOrUpdate. + */ +public final class SuppressionListAddressesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * createOrUpdateAddress.json + */ + /** + * Sample code: CreateOrUpdate SuppressionListAddress resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void createOrUpdateSuppressionListAddressResource( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionListAddresses() + .define("11112222-3333-4444-5555-aaaabbbbcccc") + .withExistingSuppressionList("contosoResourceGroup", "contosoEmailService", "contoso.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222") + .withEmail("newuser1@fabrikam.com") + .withFirstName("updatedFirstName") + .create(); + } +} +``` + +### SuppressionListAddresses_Delete + +```java +/** + * Samples for SuppressionListAddresses Delete. + */ +public final class SuppressionListAddressesDeleteSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * deleteAddress.json + */ + /** + * Sample code: Delete a SuppressionListAddress resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + deleteASuppressionListAddressResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionListAddresses() + .deleteWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222", "11112222-3333-4444-5555-999999999999", + com.azure.core.util.Context.NONE); + } +} +``` + +### SuppressionListAddresses_Get + +```java +/** + * Samples for SuppressionListAddresses Get. + */ +public final class SuppressionListAddressesGetSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * getAddress.json + */ + /** + * Sample code: Get a SuppressionListAddress resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + getASuppressionListAddressResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionListAddresses() + .getWithResponse("contosoResourceGroup", "contosoEmailService", "contoso.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222", "11112222-3333-4444-5555-aaaabbbbcccc", + com.azure.core.util.Context.NONE); + } +} +``` + +### SuppressionListAddresses_List + +```java +/** + * Samples for SuppressionListAddresses List. + */ +public final class SuppressionListAddressesListSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * getAddresses.json + */ + /** + * Sample code: Get all SuppressionListAddresses resources for a SuppressionList resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void getAllSuppressionListAddressesResourcesForASuppressionListResource( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionListAddresses() + .list("contosoResourceGroup", "contosoEmailService", "contoso.com", "aaaa1111-bbbb-2222-3333-aaaa11112222", + com.azure.core.util.Context.NONE); + } +} +``` + +### SuppressionLists_CreateOrUpdate + +```java +/** + * Samples for SuppressionLists CreateOrUpdate. + */ +public final class SuppressionListsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * createOrUpdateSuppressionList.json + */ + /** + * Sample code: CreateOrUpdate SuppressionLists resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + createOrUpdateSuppressionListsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionLists() + .define("aaaa1111-bbbb-2222-3333-aaaa11112222") + .withExistingDomain("contosoResourceGroup", "contosoEmailService", "contoso.com") + .withListName("contosoNewsAlerts") + .create(); + } +} +``` + +### SuppressionLists_Delete + +```java +/** + * Samples for SuppressionLists Delete. + */ +public final class SuppressionListsDeleteSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * deleteSuppressionList.json + */ + /** + * Sample code: Delete a SuppressionLists resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + deleteASuppressionListsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionLists() + .deleteWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222", com.azure.core.util.Context.NONE); + } +} +``` + +### SuppressionLists_Get + +```java +/** + * Samples for SuppressionLists Get. + */ +public final class SuppressionListsGetSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * getSuppressionList.json + */ + /** + * Sample code: Get a SuppressionList resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + getASuppressionListResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionLists() + .getWithResponse("contosoResourceGroup", "contosoEmailService", "contoso.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222", com.azure.core.util.Context.NONE); + } +} +``` + +### SuppressionLists_ListByDomain + +```java +/** + * Samples for SuppressionLists ListByDomain. + */ +public final class SuppressionListsListByDomainSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * getSuppressionLists.json + */ + /** + * Sample code: Get all SuppressionLists resources. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + getAllSuppressionListsResources(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionLists() + .listByDomain("contosoResourceGroup", "contosoEmailService", "contoso.com", + com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/communication/azure-resourcemanager-communication/pom.xml b/sdk/communication/azure-resourcemanager-communication/pom.xml index 5e068904d425..51b19f74e12f 100644 --- a/sdk/communication/azure-resourcemanager-communication/pom.xml +++ b/sdk/communication/azure-resourcemanager-communication/pom.xml @@ -14,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-communication - 2.3.0-beta.1 + 2.3.0 jar Microsoft Azure SDK for Communication Management - This package contains Microsoft Azure SDK for Communication Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure Communication Services. Package tag package-2023-04. + This package contains Microsoft Azure SDK for Communication Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure Communication Services. Package tag package-2025-09-01. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,6 @@ UTF-8 0 0 - false diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java index d39d141f3e31..148d86e3c378 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java @@ -22,6 +22,7 @@ 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.communication.fluent.CommunicationServiceManagementClient; import com.azure.resourcemanager.communication.implementation.CommunicationServiceManagementClientBuilder; @@ -30,15 +31,22 @@ import com.azure.resourcemanager.communication.implementation.EmailServicesImpl; import com.azure.resourcemanager.communication.implementation.OperationsImpl; import com.azure.resourcemanager.communication.implementation.SenderUsernamesImpl; +import com.azure.resourcemanager.communication.implementation.SmtpUsernamesImpl; +import com.azure.resourcemanager.communication.implementation.SuppressionListAddressesImpl; +import com.azure.resourcemanager.communication.implementation.SuppressionListsImpl; import com.azure.resourcemanager.communication.models.CommunicationServices; import com.azure.resourcemanager.communication.models.Domains; import com.azure.resourcemanager.communication.models.EmailServices; import com.azure.resourcemanager.communication.models.Operations; import com.azure.resourcemanager.communication.models.SenderUsernames; +import com.azure.resourcemanager.communication.models.SmtpUsernames; +import com.azure.resourcemanager.communication.models.SuppressionListAddresses; +import com.azure.resourcemanager.communication.models.SuppressionLists; 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; @@ -57,6 +65,12 @@ public final class CommunicationManager { private SenderUsernames senderUsernames; + private SmtpUsernames smtpUsernames; + + private SuppressionLists suppressionLists; + + private SuppressionListAddresses suppressionListAddresses; + private final CommunicationServiceManagementClient clientObject; private CommunicationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -109,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-communication.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -216,12 +233,14 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil 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.communication") .append("/") - .append("2.2.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -327,6 +346,43 @@ public SenderUsernames senderUsernames() { return senderUsernames; } + /** + * Gets the resource collection API of SmtpUsernames. It manages SmtpUsernameResource. + * + * @return Resource collection API of SmtpUsernames. + */ + public SmtpUsernames smtpUsernames() { + if (this.smtpUsernames == null) { + this.smtpUsernames = new SmtpUsernamesImpl(clientObject.getSmtpUsernames(), this); + } + return smtpUsernames; + } + + /** + * Gets the resource collection API of SuppressionLists. It manages SuppressionListResource. + * + * @return Resource collection API of SuppressionLists. + */ + public SuppressionLists suppressionLists() { + if (this.suppressionLists == null) { + this.suppressionLists = new SuppressionListsImpl(clientObject.getSuppressionLists(), this); + } + return suppressionLists; + } + + /** + * Gets the resource collection API of SuppressionListAddresses. It manages SuppressionListAddressResource. + * + * @return Resource collection API of SuppressionListAddresses. + */ + public SuppressionListAddresses suppressionListAddresses() { + if (this.suppressionListAddresses == null) { + this.suppressionListAddresses + = new SuppressionListAddressesImpl(clientObject.getSuppressionListAddresses(), this); + } + return suppressionListAddresses; + } + /** * Gets wrapped service client CommunicationServiceManagementClient providing direct access to the underlying * auto-generated API implementation, based on Azure REST API. diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java index d24e14239ffe..3ede2630ac80 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java @@ -80,4 +80,25 @@ public interface CommunicationServiceManagementClient { * @return the SenderUsernamesClient object. */ SenderUsernamesClient getSenderUsernames(); + + /** + * Gets the SmtpUsernamesClient object to access its operations. + * + * @return the SmtpUsernamesClient object. + */ + SmtpUsernamesClient getSmtpUsernames(); + + /** + * Gets the SuppressionListsClient object to access its operations. + * + * @return the SuppressionListsClient object. + */ + SuppressionListsClient getSuppressionLists(); + + /** + * Gets the SuppressionListAddressesClient object to access its operations. + * + * @return the SuppressionListAddressesClient object. + */ + SuppressionListAddressesClient getSuppressionListAddresses(); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SmtpUsernamesClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SmtpUsernamesClient.java new file mode 100644 index 000000000000..d7e76951471e --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SmtpUsernamesClient.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.models.SmtpUsernameResourceInner; + +/** + * An instance of this class provides access to all the operations defined in SmtpUsernamesClient. + */ +public interface SmtpUsernamesClient { + /** + * Get + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String communicationServiceName); + + /** + * Get + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String communicationServiceName, + Context context); + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 SmtpUsernameResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String communicationServiceName, + String smtpUsername, Context context); + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 SmtpUsernameResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SmtpUsernameResourceInner get(String resourceGroupName, String communicationServiceName, String smtpUsername); + + /** + * Create Or Update + * + * Create or update an SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @param parameters Parameters for the create or update operation. + * @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 object describing the smtp username resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, + String communicationServiceName, String smtpUsername, SmtpUsernameResourceInner parameters, Context context); + + /** + * Create Or Update + * + * Create or update an SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @param parameters Parameters for the create or update 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 object describing the smtp username resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SmtpUsernameResourceInner createOrUpdate(String resourceGroupName, String communicationServiceName, + String smtpUsername, SmtpUsernameResourceInner parameters); + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 communicationServiceName, String smtpUsername, + Context context); + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 communicationServiceName, String smtpUsername); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SuppressionListAddressesClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SuppressionListAddressesClient.java new file mode 100644 index 000000000000..869f0e4239d4 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SuppressionListAddressesClient.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.models.SuppressionListAddressResourceInner; + +/** + * An instance of this class provides access to all the operations defined in SuppressionListAddressesClient. + */ +public interface SuppressionListAddressesClient { + /** + * Get + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 all the addresses in a suppression list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName); + + /** + * Get + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 all the addresses in a suppression list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, Context context); + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 SuppressionListAddress along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, String addressId, Context context); + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 SuppressionListAddress. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SuppressionListAddressResourceInner get(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName, String addressId); + + /** + * Create Or Update + * + * Create or update a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @param parameters Parameters for the create or update operation. + * @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 object that represents a SuppressionList record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, String addressId, + SuppressionListAddressResourceInner parameters, Context context); + + /** + * Create Or Update + * + * Create or update a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @param parameters Parameters for the create or update 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 object that represents a SuppressionList record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SuppressionListAddressResourceInner createOrUpdate(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, String addressId, + SuppressionListAddressResourceInner parameters); + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 emailServiceName, String domainName, + String suppressionListName, String addressId, Context context); + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 emailServiceName, String domainName, String suppressionListName, + String addressId); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SuppressionListsClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SuppressionListsClient.java new file mode 100644 index 000000000000..799363d149f5 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SuppressionListsClient.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.models.SuppressionListResourceInner; + +/** + * An instance of this class provides access to all the operations defined in SuppressionListsClient. + */ +public interface SuppressionListsClient { + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDomain(String resourceGroupName, String emailServiceName, + String domainName); + + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDomain(String resourceGroupName, String emailServiceName, + String domainName, Context context); + + /** + * Get + * + * Get a SuppressionList resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 SuppressionList resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, Context context); + + /** + * Get + * + * Get a SuppressionList resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 SuppressionList resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SuppressionListResourceInner get(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName); + + /** + * Create Or Update + * + * Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList + * resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param parameters Parameters for the create or update operation. + * @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 class representing a SuppressionList resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, SuppressionListResourceInner parameters, Context context); + + /** + * Create Or Update + * + * Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList + * resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param parameters Parameters for the create or update 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 class representing a SuppressionList resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SuppressionListResourceInner createOrUpdate(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName, SuppressionListResourceInner parameters); + + /** + * Delete + * + * Delete a SuppressionList. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 emailServiceName, String domainName, + String suppressionListName, Context context); + + /** + * Delete + * + * Delete a SuppressionList. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 emailServiceName, String domainName, String suppressionListName); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceProperties.java index d85a8701fdf1..595a87a60e69 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceProperties.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceProperties.java @@ -11,6 +11,7 @@ import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.CommunicationServicesProvisioningState; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import java.io.IOException; import java.util.List; @@ -54,6 +55,17 @@ public final class CommunicationServiceProperties implements JsonSerializable linkedDomains; + /* + * Allow, disallow, or let network security perimeter configuration control public network access to the protected + * resource. Value is optional but if passed in, it must be 'Enabled', 'Disabled' or 'SecuredByPerimeter'. + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * Disable local authentication for the CommunicationService. + */ + private Boolean disableLocalAuth; + /** * Creates an instance of CommunicationServiceProperties class. */ @@ -146,6 +158,50 @@ public CommunicationServiceProperties withLinkedDomains(List linkedDomai return this; } + /** + * Get the publicNetworkAccess property: Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be 'Enabled', + * 'Disabled' or 'SecuredByPerimeter'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be 'Enabled', + * 'Disabled' or 'SecuredByPerimeter'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the CommunicationServiceProperties object itself. + */ + public CommunicationServiceProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the disableLocalAuth property: Disable local authentication for the CommunicationService. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.disableLocalAuth; + } + + /** + * Set the disableLocalAuth property: Disable local authentication for the CommunicationService. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the CommunicationServiceProperties object itself. + */ + public CommunicationServiceProperties withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; + return this; + } + /** * Validates the instance. * @@ -170,6 +226,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("dataLocation", this.dataLocation); jsonWriter.writeArrayField("linkedDomains", this.linkedDomains, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeBooleanField("disableLocalAuth", this.disableLocalAuth); return jsonWriter.writeEndObject(); } @@ -206,6 +265,12 @@ public static CommunicationServiceProperties fromJson(JsonReader jsonReader) thr } else if ("linkedDomains".equals(fieldName)) { List linkedDomains = reader.readArray(reader1 -> reader1.getString()); deserializedCommunicationServiceProperties.linkedDomains = linkedDomains; + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedCommunicationServiceProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("disableLocalAuth".equals(fieldName)) { + deserializedCommunicationServiceProperties.disableLocalAuth + = reader.getNullable(JsonReader::getBoolean); } else { reader.skipChildren(); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java index c836ea5a7be4..dceaed6de2aa 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java @@ -12,6 +12,7 @@ import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.CommunicationServicesProvisioningState; import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import java.io.IOException; import java.util.List; import java.util.Map; @@ -235,6 +236,56 @@ public CommunicationServiceResourceInner withLinkedDomains(List linkedDo return this; } + /** + * Get the publicNetworkAccess property: Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be 'Enabled', + * 'Disabled' or 'SecuredByPerimeter'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be 'Enabled', + * 'Disabled' or 'SecuredByPerimeter'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the CommunicationServiceResourceInner object itself. + */ + public CommunicationServiceResourceInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationServiceProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the disableLocalAuth property: Disable local authentication for the CommunicationService. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.innerProperties() == null ? null : this.innerProperties().disableLocalAuth(); + } + + /** + * Set the disableLocalAuth property: Disable local authentication for the CommunicationService. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the CommunicationServiceResourceInner object itself. + */ + public CommunicationServiceResourceInner withDisableLocalAuth(Boolean disableLocalAuth) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationServiceProperties(); + } + this.innerProperties().withDisableLocalAuth(disableLocalAuth); + return this; + } + /** * Validates the instance. * diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceUpdateProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceUpdateProperties.java index c388a026582d..8f7feeaabbdd 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceUpdateProperties.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceUpdateProperties.java @@ -9,6 +9,7 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import java.io.IOException; import java.util.List; @@ -23,6 +24,17 @@ public final class CommunicationServiceUpdateProperties */ private List linkedDomains; + /* + * Allow, disallow, or let network security perimeter configuration control public network access to the protected + * resource. Value is optional but if passed in, it must be 'Enabled', 'Disabled' or 'SecuredByPerimeter'. + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * Disable local authentication for the CommunicationService. + */ + private Boolean disableLocalAuth; + /** * Creates an instance of CommunicationServiceUpdateProperties class. */ @@ -49,6 +61,50 @@ public CommunicationServiceUpdateProperties withLinkedDomains(List linke return this; } + /** + * Get the publicNetworkAccess property: Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be 'Enabled', + * 'Disabled' or 'SecuredByPerimeter'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be 'Enabled', + * 'Disabled' or 'SecuredByPerimeter'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the CommunicationServiceUpdateProperties object itself. + */ + public CommunicationServiceUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the disableLocalAuth property: Disable local authentication for the CommunicationService. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.disableLocalAuth; + } + + /** + * Set the disableLocalAuth property: Disable local authentication for the CommunicationService. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the CommunicationServiceUpdateProperties object itself. + */ + public CommunicationServiceUpdateProperties withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; + return this; + } + /** * Validates the instance. * @@ -65,6 +121,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeArrayField("linkedDomains", this.linkedDomains, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeBooleanField("disableLocalAuth", this.disableLocalAuth); return jsonWriter.writeEndObject(); } @@ -87,6 +146,12 @@ public static CommunicationServiceUpdateProperties fromJson(JsonReader jsonReade if ("linkedDomains".equals(fieldName)) { List linkedDomains = reader.readArray(reader1 -> reader1.getString()); deserializedCommunicationServiceUpdateProperties.linkedDomains = linkedDomains; + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedCommunicationServiceUpdateProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("disableLocalAuth".equals(fieldName)) { + deserializedCommunicationServiceUpdateProperties.disableLocalAuth + = reader.getNullable(JsonReader::getBoolean); } else { reader.skipChildren(); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameProperties.java new file mode 100644 index 000000000000..1ef93aacbb20 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameProperties.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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; + +/** + * A class that describes the properties of a SmtpUsername resource. + */ +@Fluent +public final class SmtpUsernameProperties implements JsonSerializable { + /* + * The SMTP username. Could be free form or in the email address format. + */ + private String username; + + /* + * The application Id for the linked Entra Application. + */ + private String entraApplicationId; + + /* + * The tenant of the linked Entra Application. + */ + private String tenantId; + + /** + * Creates an instance of SmtpUsernameProperties class. + */ + public SmtpUsernameProperties() { + } + + /** + * Get the username property: The SMTP username. Could be free form or in the email address format. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The SMTP username. Could be free form or in the email address format. + * + * @param username the username value to set. + * @return the SmtpUsernameProperties object itself. + */ + public SmtpUsernameProperties withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the entraApplicationId property: The application Id for the linked Entra Application. + * + * @return the entraApplicationId value. + */ + public String entraApplicationId() { + return this.entraApplicationId; + } + + /** + * Set the entraApplicationId property: The application Id for the linked Entra Application. + * + * @param entraApplicationId the entraApplicationId value to set. + * @return the SmtpUsernameProperties object itself. + */ + public SmtpUsernameProperties withEntraApplicationId(String entraApplicationId) { + this.entraApplicationId = entraApplicationId; + return this; + } + + /** + * Get the tenantId property: The tenant of the linked Entra Application. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenant of the linked Entra Application. + * + * @param tenantId the tenantId value to set. + * @return the SmtpUsernameProperties object itself. + */ + public SmtpUsernameProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (username() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property username in model SmtpUsernameProperties")); + } + if (entraApplicationId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property entraApplicationId in model SmtpUsernameProperties")); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property tenantId in model SmtpUsernameProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SmtpUsernameProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("username", this.username); + jsonWriter.writeStringField("entraApplicationId", this.entraApplicationId); + jsonWriter.writeStringField("tenantId", this.tenantId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SmtpUsernameProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SmtpUsernameProperties 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 SmtpUsernameProperties. + */ + public static SmtpUsernameProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SmtpUsernameProperties deserializedSmtpUsernameProperties = new SmtpUsernameProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("username".equals(fieldName)) { + deserializedSmtpUsernameProperties.username = reader.getString(); + } else if ("entraApplicationId".equals(fieldName)) { + deserializedSmtpUsernameProperties.entraApplicationId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedSmtpUsernameProperties.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSmtpUsernameProperties; + }); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameResourceInner.java new file mode 100644 index 000000000000..366c6430faab --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameResourceInner.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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 java.io.IOException; + +/** + * The object describing the smtp username resource. + */ +@Fluent +public final class SmtpUsernameResourceInner extends ProxyResource { + /* + * The properties of a SmtpUsername resource. + */ + private SmtpUsernameProperties innerProperties; + + /* + * 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 SmtpUsernameResourceInner class. + */ + public SmtpUsernameResourceInner() { + } + + /** + * Get the innerProperties property: The properties of a SmtpUsername resource. + * + * @return the innerProperties value. + */ + private SmtpUsernameProperties 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. + * + * @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; + } + + /** + * Get the username property: The SMTP username. Could be free form or in the email address format. + * + * @return the username value. + */ + public String username() { + return this.innerProperties() == null ? null : this.innerProperties().username(); + } + + /** + * Set the username property: The SMTP username. Could be free form or in the email address format. + * + * @param username the username value to set. + * @return the SmtpUsernameResourceInner object itself. + */ + public SmtpUsernameResourceInner withUsername(String username) { + if (this.innerProperties() == null) { + this.innerProperties = new SmtpUsernameProperties(); + } + this.innerProperties().withUsername(username); + return this; + } + + /** + * Get the entraApplicationId property: The application Id for the linked Entra Application. + * + * @return the entraApplicationId value. + */ + public String entraApplicationId() { + return this.innerProperties() == null ? null : this.innerProperties().entraApplicationId(); + } + + /** + * Set the entraApplicationId property: The application Id for the linked Entra Application. + * + * @param entraApplicationId the entraApplicationId value to set. + * @return the SmtpUsernameResourceInner object itself. + */ + public SmtpUsernameResourceInner withEntraApplicationId(String entraApplicationId) { + if (this.innerProperties() == null) { + this.innerProperties = new SmtpUsernameProperties(); + } + this.innerProperties().withEntraApplicationId(entraApplicationId); + return this; + } + + /** + * Get the tenantId property: The tenant of the linked Entra Application. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant of the linked Entra Application. + * + * @param tenantId the tenantId value to set. + * @return the SmtpUsernameResourceInner object itself. + */ + public SmtpUsernameResourceInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new SmtpUsernameProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SmtpUsernameResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SmtpUsernameResourceInner 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 SmtpUsernameResourceInner. + */ + public static SmtpUsernameResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SmtpUsernameResourceInner deserializedSmtpUsernameResourceInner = new SmtpUsernameResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSmtpUsernameResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSmtpUsernameResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSmtpUsernameResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSmtpUsernameResourceInner.innerProperties = SmtpUsernameProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSmtpUsernameResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSmtpUsernameResourceInner; + }); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListAddressProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListAddressProperties.java new file mode 100644 index 000000000000..11e3108eb360 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListAddressProperties.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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 java.io.IOException; +import java.time.OffsetDateTime; + +/** + * A class that describes the properties of a SuppressionListAddress resource. + */ +@Fluent +public final class SuppressionListAddressProperties implements JsonSerializable { + /* + * Email address of the recipient. + */ + private String email; + + /* + * The first name of the email recipient. + */ + private String firstName; + + /* + * The last name of the email recipient. + */ + private String lastName; + + /* + * An optional property to provide contextual notes or a description for an address. + */ + private String notes; + + /* + * The date the address was last updated in a suppression list. + */ + private OffsetDateTime lastModified; + + /* + * The location where the SuppressionListAddress data is stored at rest. This value is inherited from the parent + * Domains resource. + */ + private String dataLocation; + + /** + * Creates an instance of SuppressionListAddressProperties class. + */ + public SuppressionListAddressProperties() { + } + + /** + * Get the email property: Email address of the recipient. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: Email address of the recipient. + * + * @param email the email value to set. + * @return the SuppressionListAddressProperties object itself. + */ + public SuppressionListAddressProperties withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the firstName property: The first name of the email recipient. + * + * @return the firstName value. + */ + public String firstName() { + return this.firstName; + } + + /** + * Set the firstName property: The first name of the email recipient. + * + * @param firstName the firstName value to set. + * @return the SuppressionListAddressProperties object itself. + */ + public SuppressionListAddressProperties withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get the lastName property: The last name of the email recipient. + * + * @return the lastName value. + */ + public String lastName() { + return this.lastName; + } + + /** + * Set the lastName property: The last name of the email recipient. + * + * @param lastName the lastName value to set. + * @return the SuppressionListAddressProperties object itself. + */ + public SuppressionListAddressProperties withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get the notes property: An optional property to provide contextual notes or a description for an address. + * + * @return the notes value. + */ + public String notes() { + return this.notes; + } + + /** + * Set the notes property: An optional property to provide contextual notes or a description for an address. + * + * @param notes the notes value to set. + * @return the SuppressionListAddressProperties object itself. + */ + public SuppressionListAddressProperties withNotes(String notes) { + this.notes = notes; + return this; + } + + /** + * Get the lastModified property: The date the address was last updated in a suppression list. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + return this.lastModified; + } + + /** + * Get the dataLocation property: The location where the SuppressionListAddress data is stored at rest. This value + * is inherited from the parent Domains resource. + * + * @return the dataLocation value. + */ + public String dataLocation() { + return this.dataLocation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (email() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property email in model SuppressionListAddressProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SuppressionListAddressProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("email", this.email); + jsonWriter.writeStringField("firstName", this.firstName); + jsonWriter.writeStringField("lastName", this.lastName); + jsonWriter.writeStringField("notes", this.notes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuppressionListAddressProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuppressionListAddressProperties 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 SuppressionListAddressProperties. + */ + public static SuppressionListAddressProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SuppressionListAddressProperties deserializedSuppressionListAddressProperties + = new SuppressionListAddressProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("email".equals(fieldName)) { + deserializedSuppressionListAddressProperties.email = reader.getString(); + } else if ("firstName".equals(fieldName)) { + deserializedSuppressionListAddressProperties.firstName = reader.getString(); + } else if ("lastName".equals(fieldName)) { + deserializedSuppressionListAddressProperties.lastName = reader.getString(); + } else if ("notes".equals(fieldName)) { + deserializedSuppressionListAddressProperties.notes = reader.getString(); + } else if ("lastModified".equals(fieldName)) { + deserializedSuppressionListAddressProperties.lastModified = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("dataLocation".equals(fieldName)) { + deserializedSuppressionListAddressProperties.dataLocation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSuppressionListAddressProperties; + }); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListAddressResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListAddressResourceInner.java new file mode 100644 index 000000000000..28054b5d02b3 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListAddressResourceInner.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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 java.io.IOException; +import java.time.OffsetDateTime; + +/** + * A object that represents a SuppressionList record. + */ +@Fluent +public final class SuppressionListAddressResourceInner extends ProxyResource { + /* + * The properties of a SuppressionListAddress resource. + */ + private SuppressionListAddressProperties innerProperties; + + /* + * 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 SuppressionListAddressResourceInner class. + */ + public SuppressionListAddressResourceInner() { + } + + /** + * Get the innerProperties property: The properties of a SuppressionListAddress resource. + * + * @return the innerProperties value. + */ + private SuppressionListAddressProperties 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. + * + * @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; + } + + /** + * Get the email property: Email address of the recipient. + * + * @return the email value. + */ + public String email() { + return this.innerProperties() == null ? null : this.innerProperties().email(); + } + + /** + * Set the email property: Email address of the recipient. + * + * @param email the email value to set. + * @return the SuppressionListAddressResourceInner object itself. + */ + public SuppressionListAddressResourceInner withEmail(String email) { + if (this.innerProperties() == null) { + this.innerProperties = new SuppressionListAddressProperties(); + } + this.innerProperties().withEmail(email); + return this; + } + + /** + * Get the firstName property: The first name of the email recipient. + * + * @return the firstName value. + */ + public String firstName() { + return this.innerProperties() == null ? null : this.innerProperties().firstName(); + } + + /** + * Set the firstName property: The first name of the email recipient. + * + * @param firstName the firstName value to set. + * @return the SuppressionListAddressResourceInner object itself. + */ + public SuppressionListAddressResourceInner withFirstName(String firstName) { + if (this.innerProperties() == null) { + this.innerProperties = new SuppressionListAddressProperties(); + } + this.innerProperties().withFirstName(firstName); + return this; + } + + /** + * Get the lastName property: The last name of the email recipient. + * + * @return the lastName value. + */ + public String lastName() { + return this.innerProperties() == null ? null : this.innerProperties().lastName(); + } + + /** + * Set the lastName property: The last name of the email recipient. + * + * @param lastName the lastName value to set. + * @return the SuppressionListAddressResourceInner object itself. + */ + public SuppressionListAddressResourceInner withLastName(String lastName) { + if (this.innerProperties() == null) { + this.innerProperties = new SuppressionListAddressProperties(); + } + this.innerProperties().withLastName(lastName); + return this; + } + + /** + * Get the notes property: An optional property to provide contextual notes or a description for an address. + * + * @return the notes value. + */ + public String notes() { + return this.innerProperties() == null ? null : this.innerProperties().notes(); + } + + /** + * Set the notes property: An optional property to provide contextual notes or a description for an address. + * + * @param notes the notes value to set. + * @return the SuppressionListAddressResourceInner object itself. + */ + public SuppressionListAddressResourceInner withNotes(String notes) { + if (this.innerProperties() == null) { + this.innerProperties = new SuppressionListAddressProperties(); + } + this.innerProperties().withNotes(notes); + return this; + } + + /** + * Get the lastModified property: The date the address was last updated in a suppression list. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + return this.innerProperties() == null ? null : this.innerProperties().lastModified(); + } + + /** + * Get the dataLocation property: The location where the SuppressionListAddress data is stored at rest. This value + * is inherited from the parent Domains resource. + * + * @return the dataLocation value. + */ + public String dataLocation() { + return this.innerProperties() == null ? null : this.innerProperties().dataLocation(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuppressionListAddressResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuppressionListAddressResourceInner 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 SuppressionListAddressResourceInner. + */ + public static SuppressionListAddressResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SuppressionListAddressResourceInner deserializedSuppressionListAddressResourceInner + = new SuppressionListAddressResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSuppressionListAddressResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSuppressionListAddressResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSuppressionListAddressResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSuppressionListAddressResourceInner.innerProperties + = SuppressionListAddressProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSuppressionListAddressResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSuppressionListAddressResourceInner; + }); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListProperties.java new file mode 100644 index 000000000000..f666ca875a3f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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; + +/** + * A class that describes the properties of a SuppressionList resource. + */ +@Fluent +public final class SuppressionListProperties implements JsonSerializable { + /* + * The name of the suppression list. This value must match one of the valid sender usernames of the sending domain. + */ + private String listName; + + /* + * The date the resource was last updated. + */ + private String lastUpdatedTimestamp; + + /* + * The date the resource was created. + */ + private String createdTimestamp; + + /* + * The location where the SuppressionListAddress data is stored at rest. This value is inherited from the parent + * Domains resource. + */ + private String dataLocation; + + /** + * Creates an instance of SuppressionListProperties class. + */ + public SuppressionListProperties() { + } + + /** + * Get the listName property: The name of the suppression list. This value must match one of the valid sender + * usernames of the sending domain. + * + * @return the listName value. + */ + public String listName() { + return this.listName; + } + + /** + * Set the listName property: The name of the suppression list. This value must match one of the valid sender + * usernames of the sending domain. + * + * @param listName the listName value to set. + * @return the SuppressionListProperties object itself. + */ + public SuppressionListProperties withListName(String listName) { + this.listName = listName; + return this; + } + + /** + * Get the lastUpdatedTimestamp property: The date the resource was last updated. + * + * @return the lastUpdatedTimestamp value. + */ + public String lastUpdatedTimestamp() { + return this.lastUpdatedTimestamp; + } + + /** + * Get the createdTimestamp property: The date the resource was created. + * + * @return the createdTimestamp value. + */ + public String createdTimestamp() { + return this.createdTimestamp; + } + + /** + * Get the dataLocation property: The location where the SuppressionListAddress data is stored at rest. This value + * is inherited from the parent Domains resource. + * + * @return the dataLocation value. + */ + public String dataLocation() { + return this.dataLocation; + } + + /** + * 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("listName", this.listName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuppressionListProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuppressionListProperties 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 SuppressionListProperties. + */ + public static SuppressionListProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SuppressionListProperties deserializedSuppressionListProperties = new SuppressionListProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("listName".equals(fieldName)) { + deserializedSuppressionListProperties.listName = reader.getString(); + } else if ("lastUpdatedTimeStamp".equals(fieldName)) { + deserializedSuppressionListProperties.lastUpdatedTimestamp = reader.getString(); + } else if ("createdTimeStamp".equals(fieldName)) { + deserializedSuppressionListProperties.createdTimestamp = reader.getString(); + } else if ("dataLocation".equals(fieldName)) { + deserializedSuppressionListProperties.dataLocation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSuppressionListProperties; + }); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListResourceInner.java new file mode 100644 index 000000000000..d1e6ca359fd5 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListResourceInner.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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 java.io.IOException; + +/** + * A class representing a SuppressionList resource. + */ +@Fluent +public final class SuppressionListResourceInner extends ProxyResource { + /* + * The properties of a SuppressionList resource. + */ + private SuppressionListProperties innerProperties; + + /* + * 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 SuppressionListResourceInner class. + */ + public SuppressionListResourceInner() { + } + + /** + * Get the innerProperties property: The properties of a SuppressionList resource. + * + * @return the innerProperties value. + */ + private SuppressionListProperties 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. + * + * @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; + } + + /** + * Get the listName property: The name of the suppression list. This value must match one of the valid sender + * usernames of the sending domain. + * + * @return the listName value. + */ + public String listName() { + return this.innerProperties() == null ? null : this.innerProperties().listName(); + } + + /** + * Set the listName property: The name of the suppression list. This value must match one of the valid sender + * usernames of the sending domain. + * + * @param listName the listName value to set. + * @return the SuppressionListResourceInner object itself. + */ + public SuppressionListResourceInner withListName(String listName) { + if (this.innerProperties() == null) { + this.innerProperties = new SuppressionListProperties(); + } + this.innerProperties().withListName(listName); + return this; + } + + /** + * Get the lastUpdatedTimestamp property: The date the resource was last updated. + * + * @return the lastUpdatedTimestamp value. + */ + public String lastUpdatedTimestamp() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedTimestamp(); + } + + /** + * Get the createdTimestamp property: The date the resource was created. + * + * @return the createdTimestamp value. + */ + public String createdTimestamp() { + return this.innerProperties() == null ? null : this.innerProperties().createdTimestamp(); + } + + /** + * Get the dataLocation property: The location where the SuppressionListAddress data is stored at rest. This value + * is inherited from the parent Domains resource. + * + * @return the dataLocation value. + */ + public String dataLocation() { + return this.innerProperties() == null ? null : this.innerProperties().dataLocation(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuppressionListResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuppressionListResourceInner 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 SuppressionListResourceInner. + */ + public static SuppressionListResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SuppressionListResourceInner deserializedSuppressionListResourceInner = new SuppressionListResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSuppressionListResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSuppressionListResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSuppressionListResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSuppressionListResourceInner.innerProperties + = SuppressionListProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSuppressionListResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSuppressionListResourceInner; + }); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java index ce3b59febe14..e7993401810d 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java @@ -15,12 +15,15 @@ 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.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.communication.fluent.CommunicationServiceManagementClient; @@ -29,6 +32,9 @@ import com.azure.resourcemanager.communication.fluent.EmailServicesClient; import com.azure.resourcemanager.communication.fluent.OperationsClient; import com.azure.resourcemanager.communication.fluent.SenderUsernamesClient; +import com.azure.resourcemanager.communication.fluent.SmtpUsernamesClient; +import com.azure.resourcemanager.communication.fluent.SuppressionListAddressesClient; +import com.azure.resourcemanager.communication.fluent.SuppressionListsClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -197,6 +203,48 @@ public SenderUsernamesClient getSenderUsernames() { return this.senderUsernames; } + /** + * The SmtpUsernamesClient object to access its operations. + */ + private final SmtpUsernamesClient smtpUsernames; + + /** + * Gets the SmtpUsernamesClient object to access its operations. + * + * @return the SmtpUsernamesClient object. + */ + public SmtpUsernamesClient getSmtpUsernames() { + return this.smtpUsernames; + } + + /** + * The SuppressionListsClient object to access its operations. + */ + private final SuppressionListsClient suppressionLists; + + /** + * Gets the SuppressionListsClient object to access its operations. + * + * @return the SuppressionListsClient object. + */ + public SuppressionListsClient getSuppressionLists() { + return this.suppressionLists; + } + + /** + * The SuppressionListAddressesClient object to access its operations. + */ + private final SuppressionListAddressesClient suppressionListAddresses; + + /** + * Gets the SuppressionListAddressesClient object to access its operations. + * + * @return the SuppressionListAddressesClient object. + */ + public SuppressionListAddressesClient getSuppressionListAddresses() { + return this.suppressionListAddresses; + } + /** * Initializes an instance of CommunicationServiceManagementClient client. * @@ -214,12 +262,15 @@ public SenderUsernamesClient getSenderUsernames() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2023-04-01"; + this.apiVersion = "2025-09-01"; this.operations = new OperationsClientImpl(this); this.communicationServices = new CommunicationServicesClientImpl(this); this.domains = new DomainsClientImpl(this); this.emailServices = new EmailServicesClientImpl(this); this.senderUsernames = new SenderUsernamesClientImpl(this); + this.smtpUsernames = new SmtpUsernamesClientImpl(this); + this.suppressionLists = new SuppressionListsClientImpl(this); + this.suppressionListAddresses = new SuppressionListAddressesClientImpl(this); } /** @@ -259,6 +310,23 @@ public PollerFlux, U> getLroResult(Mono type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + /** * Gets the final result, or an error, based on last async poll response. * diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java index a9ca1c32da9f..d19e1b4da006 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java @@ -16,6 +16,7 @@ import com.azure.resourcemanager.communication.models.LinkNotificationHubParameters; import com.azure.resourcemanager.communication.models.LinkedNotificationHub; import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import com.azure.resourcemanager.communication.models.RegenerateKeyParameters; import java.util.Collections; import java.util.List; @@ -93,6 +94,14 @@ public List linkedDomains() { } } + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public Boolean disableLocalAuth() { + return this.innerModel().disableLocalAuth(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -267,7 +276,27 @@ public CommunicationServiceResourceImpl withLinkedDomains(List linkedDom } } + public CommunicationServiceResourceImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } else { + this.updateParameters.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + } + + public CommunicationServiceResourceImpl withDisableLocalAuth(Boolean disableLocalAuth) { + if (isInCreateMode()) { + this.innerModel().withDisableLocalAuth(disableLocalAuth); + return this; + } else { + this.updateParameters.withDisableLocalAuth(disableLocalAuth); + return this; + } + } + private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java index 1a199f612113..87bab39879a6 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java @@ -29,8 +29,10 @@ 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.communication.fluent.CommunicationServicesClient; @@ -77,7 +79,7 @@ public final class CommunicationServicesClientImpl implements CommunicationServi * by the proxy service to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "CommunicationService") + @ServiceInterface(name = "CommunicationServiceManagementClientCommunicationServices") public interface CommunicationServicesService { @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability") @@ -88,6 +90,15 @@ Mono> checkNameAvailability(@HostPa @BodyParam("application/json") NameAvailabilityParameters nameAvailabilityParameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response checkNameAvailabilitySync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") NameAvailabilityParameters nameAvailabilityParameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/linkNotificationHub") @ExpectedResponses({ 200 }) @@ -99,6 +110,17 @@ Mono> linkNotificationHub(@HostParam("$host @BodyParam("application/json") LinkNotificationHubParameters linkNotificationHubParameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/linkNotificationHub") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response linkNotificationHubSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @BodyParam("application/json") LinkNotificationHubParameters linkNotificationHubParameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices") @ExpectedResponses({ 200 }) @@ -107,6 +129,14 @@ Mono> list(@HostParam("$host") String @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @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.Communication/communicationServices") @ExpectedResponses({ 200 }) @@ -116,6 +146,15 @@ Mono> listByResourceGroup(@HostParam( @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}") @ExpectedResponses({ 200 }) @@ -127,6 +166,17 @@ Mono> update(@HostParam("$host") Str @BodyParam("application/json") CommunicationServiceResourceUpdate parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @BodyParam("application/json") CommunicationServiceResourceUpdate parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}") @ExpectedResponses({ 200 }) @@ -137,6 +187,16 @@ Mono> getByResourceGroup(@HostParam( @PathParam("communicationServiceName") String communicationServiceName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}") @ExpectedResponses({ 200, 201 }) @@ -148,6 +208,17 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @BodyParam("application/json") CommunicationServiceResourceInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @BodyParam("application/json") CommunicationServiceResourceInner parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}") @ExpectedResponses({ 200, 202, 204 }) @@ -158,6 +229,16 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("communicationServiceName") String communicationServiceName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys") @ExpectedResponses({ 200 }) @@ -168,6 +249,16 @@ Mono> listKeys(@HostParam("$host") Strin @PathParam("communicationServiceName") String communicationServiceName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listKeysSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey") @ExpectedResponses({ 200 }) @@ -179,6 +270,17 @@ Mono> regenerateKey(@HostParam("$host") @BodyParam("application/json") RegenerateKeyParameters parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response regenerateKeySync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @BodyParam("application/json") RegenerateKeyParameters parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -187,6 +289,14 @@ Mono> listBySubscriptionNext( @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) + Response listBySubscriptionNextSync( + @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 }) @@ -194,6 +304,14 @@ Mono> listBySubscriptionNext( Mono> listByResourceGroupNext( @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) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -232,41 +350,6 @@ Mono> listByResourceGroupNext( .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Check Name Availability - * - * Checks that the CommunicationService name is valid and is not already in use. - * - * @param nameAvailabilityParameters Parameters supplied to the operation. - * @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 check availability result along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - checkNameAvailabilityWithResponseAsync(NameAvailabilityParameters nameAvailabilityParameters, 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.")); - } - if (nameAvailabilityParameters == null) { - return Mono.error( - new IllegalArgumentException("Parameter nameAvailabilityParameters is required and cannot be null.")); - } else { - nameAvailabilityParameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.checkNameAvailability(this.client.getEndpoint(), this.client.getSubscriptionId(), - this.client.getApiVersion(), nameAvailabilityParameters, accept, context); - } - /** * Check Name Availability * @@ -300,7 +383,26 @@ Mono> listByResourceGroupNext( @ServiceMethod(returns = ReturnType.SINGLE) public Response checkNameAvailabilityWithResponse(NameAvailabilityParameters nameAvailabilityParameters, Context context) { - return checkNameAvailabilityWithResponseAsync(nameAvailabilityParameters, 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 (nameAvailabilityParameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter nameAvailabilityParameters is required and cannot be null.")); + } else { + nameAvailabilityParameters.validate(); + } + final String accept = "application/json"; + return service.checkNameAvailabilitySync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getApiVersion(), nameAvailabilityParameters, accept, context); } /** @@ -364,50 +466,6 @@ private Mono> linkNotificationHubWithRespon .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Link Notification Hub - * - * Links an Azure Notification Hub to this communication service. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param linkNotificationHubParameters Parameters supplied to the operation. - * @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 notification hub that has been linked to the communication service along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> linkNotificationHubWithResponseAsync(String resourceGroupName, - String communicationServiceName, LinkNotificationHubParameters linkNotificationHubParameters, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (communicationServiceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); - } - if (linkNotificationHubParameters != null) { - linkNotificationHubParameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.linkNotificationHub(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, linkNotificationHubParameters, - accept, context); - } - /** * Link Notification Hub * @@ -446,8 +504,32 @@ private Mono linkNotificationHubAsync(String resourc @ServiceMethod(returns = ReturnType.SINGLE) public Response linkNotificationHubWithResponse(String resourceGroupName, String communicationServiceName, LinkNotificationHubParameters linkNotificationHubParameters, Context context) { - return linkNotificationHubWithResponseAsync(resourceGroupName, communicationServiceName, - linkNotificationHubParameters, 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (linkNotificationHubParameters != null) { + linkNotificationHubParameters.validate(); + } + final String accept = "application/json"; + return service.linkNotificationHubSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, linkNotificationHubParameters, + accept, context); } /** @@ -503,30 +585,15 @@ private Mono> listSinglePageAsy * * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return object that includes an array of CommunicationServices and a possible link for next set 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.")); - } - 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** @@ -536,13 +603,26 @@ private Mono> listSinglePageAsy * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return object that includes an array of CommunicationServices and a possible link for next set as paginated - * response with {@link PagedFlux}. + * @return object that includes an array of CommunicationServices and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(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.")); + } + 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(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -554,13 +634,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return object that includes an array of CommunicationServices and a possible link for next set as paginated - * response with {@link PagedFlux}. + * @return object that includes an array of CommunicationServices and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(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.")); + } + 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(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -575,7 +668,7 @@ private PagedFlux listAsync(Context context) */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); } /** @@ -592,7 +685,8 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); } /** @@ -637,35 +731,16 @@ public PagedIterable list(Context context) { * Handles requests to list all resources in a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @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 object that includes an array of CommunicationServices and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return object that includes an array of CommunicationServices and a possible link for next set as paginated + * response with {@link PagedFlux}. */ - @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 (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"; - context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, 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 listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** @@ -677,13 +752,30 @@ 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 object that includes an array of CommunicationServices and a possible link for next set as paginated - * response with {@link PagedFlux}. + * @return object that includes an array of CommunicationServices and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + 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, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -696,14 +788,31 @@ private PagedFlux listByResourceGroupAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return object that includes an array of CommunicationServices and a possible link for next set as paginated - * response with {@link PagedFlux}. + * @return object that includes an array of CommunicationServices and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, 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, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -720,7 +829,8 @@ private PagedFlux listByResourceGroupAsync(St */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); } /** @@ -739,7 +849,8 @@ public PagedIterable listByResourceGroup(Stri @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); } /** @@ -786,51 +897,6 @@ private Mono> updateWithResponseAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Update - * - * Operation to update an existing CommunicationService. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameters for the update operation. - * @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 class representing a CommunicationService resource along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - String communicationServiceName, CommunicationServiceResourceUpdate parameters, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (communicationServiceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter communicationServiceName 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.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, communicationServiceName, parameters, accept, context); - } - /** * Update * @@ -868,7 +934,34 @@ private Mono updateAsync(String resourceGroup @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse(String resourceGroupName, String communicationServiceName, CommunicationServiceResourceUpdate parameters, Context context) { - return updateWithResponseAsync(resourceGroupName, communicationServiceName, parameters, 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName 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 accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, parameters, accept, context); } /** @@ -929,45 +1022,6 @@ public CommunicationServiceResourceInner update(String resourceGroupName, String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get - * - * Get the CommunicationService and its properties. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String communicationServiceName, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (communicationServiceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, accept, context); - } - /** * Get * @@ -1003,7 +1057,28 @@ private Mono getByResourceGroupAsync(String r @ServiceMethod(returns = ReturnType.SINGLE) public Response getByResourceGroupWithResponse(String resourceGroupName, String communicationServiceName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, communicationServiceName, 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, accept, context); } /** @@ -1078,41 +1153,43 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. * @param parameters Parameters for the create or update operation. - * @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 class representing a CommunicationService resource along with {@link Response} on successful completion - * of {@link Mono}. + * @return a class representing a CommunicationService resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String communicationServiceName, CommunicationServiceResourceInner parameters, Context context) { + private Response createOrUpdateWithResponse(String resourceGroupName, String communicationServiceName, + CommunicationServiceResourceInner parameters) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (communicationServiceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, parameters, accept, context); + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, parameters, accept, + Context.NONE); } /** @@ -1123,20 +1200,43 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. * @param parameters Parameters for the create or update operation. + * @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 a class representing a CommunicationService resource. + * @return a class representing a CommunicationService resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, CommunicationServiceResourceInner> - beginCreateOrUpdateAsync(String resourceGroupName, String communicationServiceName, - CommunicationServiceResourceInner parameters) { - Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, communicationServiceName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), CommunicationServiceResourceInner.class, - CommunicationServiceResourceInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String communicationServiceName, + CommunicationServiceResourceInner 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName 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 accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, parameters, accept, context); } /** @@ -1147,7 +1247,6 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. * @param parameters Parameters for the create or update operation. - * @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. @@ -1156,13 +1255,12 @@ private Mono>> createOrUpdateWithResponseAsync(String @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, CommunicationServiceResourceInner> beginCreateOrUpdateAsync(String resourceGroupName, String communicationServiceName, - CommunicationServiceResourceInner parameters, Context context) { - context = this.client.mergeContext(context); + CommunicationServiceResourceInner parameters) { Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, communicationServiceName, parameters, context); + = createOrUpdateWithResponseAsync(resourceGroupName, communicationServiceName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), CommunicationServiceResourceInner.class, - CommunicationServiceResourceInner.class, context); + CommunicationServiceResourceInner.class, this.client.getContext()); } /** @@ -1182,7 +1280,10 @@ private Mono>> createOrUpdateWithResponseAsync(String public SyncPoller, CommunicationServiceResourceInner> beginCreateOrUpdate(String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { - return this.beginCreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters).getSyncPoller(); + Response response + = createOrUpdateWithResponse(resourceGroupName, communicationServiceName, parameters); + return this.client.getLroResult(response, + CommunicationServiceResourceInner.class, CommunicationServiceResourceInner.class, Context.NONE); } /** @@ -1203,8 +1304,10 @@ private Mono>> createOrUpdateWithResponseAsync(String public SyncPoller, CommunicationServiceResourceInner> beginCreateOrUpdate(String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters, Context context) { - return this.beginCreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters, context) - .getSyncPoller(); + Response response + = createOrUpdateWithResponse(resourceGroupName, communicationServiceName, parameters, context); + return this.client.getLroResult(response, + CommunicationServiceResourceInner.class, CommunicationServiceResourceInner.class, context); } /** @@ -1227,27 +1330,6 @@ private Mono createOrUpdateAsync(String resou .flatMap(this.client::getLroFinalResultOrError); } - /** - * Create Or Update - * - * Create a new CommunicationService or update an existing CommunicationService. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameters for the create or update operation. - * @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 class representing a CommunicationService resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, - String communicationServiceName, CommunicationServiceResourceInner parameters, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Create Or Update * @@ -1264,7 +1346,7 @@ private Mono createOrUpdateAsync(String resou @ServiceMethod(returns = ReturnType.SINGLE) public CommunicationServiceResourceInner createOrUpdate(String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { - return createOrUpdateAsync(resourceGroupName, communicationServiceName, parameters).block(); + return beginCreateOrUpdate(resourceGroupName, communicationServiceName, parameters).getFinalResult(); } /** @@ -1284,7 +1366,7 @@ public CommunicationServiceResourceInner createOrUpdate(String resourceGroupName @ServiceMethod(returns = ReturnType.SINGLE) public CommunicationServiceResourceInner createOrUpdate(String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters, Context context) { - return createOrUpdateAsync(resourceGroupName, communicationServiceName, parameters, context).block(); + return beginCreateOrUpdate(resourceGroupName, communicationServiceName, parameters, context).getFinalResult(); } /** @@ -1332,35 +1414,35 @@ private Mono>> deleteWithResponseAsync(String resource * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService 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 Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, - String communicationServiceName, Context context) { + private Response deleteWithResponse(String resourceGroupName, String communicationServiceName) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (communicationServiceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, communicationServiceName, accept, context); + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, accept, Context.NONE); } /** @@ -1370,17 +1452,37 @@ private Mono>> deleteWithResponseAsync(String resource * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService 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 PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String communicationServiceName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, communicationServiceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String communicationServiceName, + 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, accept, context); } /** @@ -1390,7 +1492,6 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService 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. @@ -1398,12 +1499,10 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String communicationServiceName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = deleteWithResponseAsync(resourceGroupName, communicationServiceName, context); + String communicationServiceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, communicationServiceName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -1420,7 +1519,8 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String communicationServiceName) { - return this.beginDeleteAsync(resourceGroupName, communicationServiceName).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, communicationServiceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -1439,7 +1539,8 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String communicationServiceName, Context context) { - return this.beginDeleteAsync(resourceGroupName, communicationServiceName, context).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, communicationServiceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -1460,25 +1561,6 @@ private Mono deleteAsync(String resourceGroupName, String communicationSer .flatMap(this.client::getLroFinalResultOrError); } - /** - * Delete - * - * Operation to delete a CommunicationService. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService 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 A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String communicationServiceName, Context context) { - return beginDeleteAsync(resourceGroupName, communicationServiceName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Delete * @@ -1492,7 +1574,7 @@ private Mono deleteAsync(String resourceGroupName, String communicationSer */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String communicationServiceName) { - deleteAsync(resourceGroupName, communicationServiceName).block(); + beginDelete(resourceGroupName, communicationServiceName).getFinalResult(); } /** @@ -1509,7 +1591,7 @@ public void delete(String resourceGroupName, String communicationServiceName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String communicationServiceName, Context context) { - deleteAsync(resourceGroupName, communicationServiceName, context).block(); + beginDelete(resourceGroupName, communicationServiceName, context).getFinalResult(); } /** @@ -1551,45 +1633,6 @@ private Mono> listKeysWithResponseAsync( .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * List Keys - * - * Get the access keys of the CommunicationService resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listKeysWithResponseAsync(String resourceGroupName, - String communicationServiceName, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (communicationServiceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listKeys(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, communicationServiceName, accept, context); - } - /** * List Keys * @@ -1625,7 +1668,28 @@ private Mono listKeysAsync(String resourceGroupNa @ServiceMethod(returns = ReturnType.SINGLE) public Response listKeysWithResponse(String resourceGroupName, String communicationServiceName, Context context) { - return listKeysWithResponseAsync(resourceGroupName, communicationServiceName, 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.listKeysSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, accept, context); } /** @@ -1691,51 +1755,6 @@ private Mono> regenerateKeyWithResponseA .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Regenerate Key - * - * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameter that describes the Regenerate Key Operation. - * @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 class representing the access keys of a CommunicationService along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> regenerateKeyWithResponseAsync(String resourceGroupName, - String communicationServiceName, RegenerateKeyParameters parameters, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (communicationServiceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter communicationServiceName 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.regenerateKey(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, parameters, accept, context); - } - /** * Regenerate Key * @@ -1773,7 +1792,34 @@ private Mono regenerateKeyAsync(String resourceGr @ServiceMethod(returns = ReturnType.SINGLE) public Response regenerateKeyWithResponse(String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters, Context context) { - return regenerateKeyWithResponseAsync(resourceGroupName, communicationServiceName, parameters, 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName 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 accept = "application/json"; + return service.regenerateKeySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, parameters, accept, context); } /** @@ -1797,6 +1843,8 @@ public CommunicationServiceKeysInner regenerateKey(String resourceGroupName, Str } /** + * List By Subscription + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1826,6 +1874,38 @@ public CommunicationServiceKeysInner regenerateKey(String resourceGroupName, Str } /** + * List By Subscription + * + * 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 object that includes an array of CommunicationServices and a possible link for next set along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(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.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List By Subscription + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1834,26 +1914,30 @@ public CommunicationServiceKeysInner regenerateKey(String resourceGroupName, Str * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return object that includes an array of CommunicationServices and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listBySubscriptionNextSinglePage(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.listBySubscriptionNext(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.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** + * List By Resource Group + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1883,6 +1967,38 @@ public CommunicationServiceKeysInner regenerateKey(String resourceGroupName, Str } /** + * List By Resource Group + * + * 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 object that includes an array of CommunicationServices and a possible link for next set along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(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.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List By Resource Group + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1891,22 +2007,26 @@ public CommunicationServiceKeysInner regenerateKey(String resourceGroupName, Str * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return object that includes an array of CommunicationServices and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByResourceGroupNextSinglePage(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.listByResourceGroupNext(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.listByResourceGroupNextSync(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(CommunicationServicesClientImpl.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainResourceImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainResourceImpl.java index 262bd8db8683..6ae44ef6ec65 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainResourceImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainResourceImpl.java @@ -237,6 +237,6 @@ public DomainResourceImpl withUserEngagementTracking(UserEngagementTracking user } private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainsClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainsClientImpl.java index 500bcf446c70..f8fefe3ea32f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainsClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainsClientImpl.java @@ -29,8 +29,10 @@ 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.communication.fluent.DomainsClient; @@ -71,7 +73,7 @@ public final class DomainsClientImpl implements DomainsClient { * service to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "CommunicationService") + @ServiceInterface(name = "CommunicationServiceManagementClientDomains") public interface DomainsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}") @@ -83,6 +85,16 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}") @ExpectedResponses({ 200, 201 }) @@ -94,6 +106,17 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @BodyParam("application/json") DomainResourceInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @BodyParam("application/json") DomainResourceInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}") @ExpectedResponses({ 200, 202, 204 }) @@ -104,6 +127,16 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}") @ExpectedResponses({ 200, 201 }) @@ -115,6 +148,17 @@ Mono>> update(@HostParam("$host") String endpoint, @BodyParam("application/json") UpdateDomainRequestParameters parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @BodyParam("application/json") UpdateDomainRequestParameters parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains") @ExpectedResponses({ 200 }) @@ -125,6 +169,16 @@ Mono> listByEmailServiceResource(@HostParam("$host" @PathParam("emailServiceName") String emailServiceName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByEmailServiceResourceSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/initiateVerification") @ExpectedResponses({ 202 }) @@ -136,6 +190,17 @@ Mono>> initiateVerification(@HostParam("$host") String @BodyParam("application/json") VerificationParameter parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/initiateVerification") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response initiateVerificationSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @BodyParam("application/json") VerificationParameter parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/cancelVerification") @ExpectedResponses({ 202 }) @@ -147,6 +212,17 @@ Mono>> cancelVerification(@HostParam("$host") String e @BodyParam("application/json") VerificationParameter parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/cancelVerification") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response cancelVerificationSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @BodyParam("application/json") VerificationParameter parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -154,6 +230,14 @@ Mono>> cancelVerification(@HostParam("$host") String e Mono> listByEmailServiceResourceNext( @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) + Response listByEmailServiceResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -199,49 +283,6 @@ private Mono> getWithResponseAsync(String resource .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get - * - * Get the Domains resource and its properties. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param domainName The name of the Domains 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 Domains resource and its properties along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String emailServiceName, - String domainName, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); - } - if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, emailServiceName, domainName, accept, context); - } - /** * Get * @@ -278,7 +319,31 @@ private Mono getAsync(String resourceGroupName, String emai @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String emailServiceName, String domainName, Context context) { - return getWithResponseAsync(resourceGroupName, emailServiceName, domainName, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, emailServiceName, domainName, accept, context); } /** @@ -358,45 +423,46 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Parameters for the create or update operation. - * @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 class representing a Domains resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return a class representing a Domains resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String emailServiceName, String domainName, DomainResourceInner parameters, Context context) { + private Response createOrUpdateWithResponse(String resourceGroupName, String emailServiceName, + String domainName, DomainResourceInner parameters) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); } if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, parameters, accept, - context); + Context.NONE); } /** @@ -408,18 +474,47 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Parameters for the create or update operation. + * @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 a class representing a Domains resource. + * @return a class representing a Domains resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DomainResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String emailServiceName, String domainName, DomainResourceInner parameters) { - Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - DomainResourceInner.class, DomainResourceInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String emailServiceName, + String domainName, DomainResourceInner 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName 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 accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, parameters, accept, + context); } /** @@ -431,7 +526,6 @@ private PollerFlux, DomainResourceInner> beginCr * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Parameters for the create or update operation. - * @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. @@ -439,13 +533,11 @@ private PollerFlux, DomainResourceInner> beginCr */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, DomainResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String emailServiceName, String domainName, DomainResourceInner parameters, - Context context) { - context = this.client.mergeContext(context); + String resourceGroupName, String emailServiceName, String domainName, DomainResourceInner parameters) { Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters, context); + = createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - DomainResourceInner.class, DomainResourceInner.class, context); + DomainResourceInner.class, DomainResourceInner.class, this.client.getContext()); } /** @@ -465,8 +557,10 @@ private PollerFlux, DomainResourceInner> beginCr @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DomainResourceInner> beginCreateOrUpdate( String resourceGroupName, String emailServiceName, String domainName, DomainResourceInner parameters) { - return this.beginCreateOrUpdateAsync(resourceGroupName, emailServiceName, domainName, parameters) - .getSyncPoller(); + Response response + = createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, parameters); + return this.client.getLroResult(response, DomainResourceInner.class, + DomainResourceInner.class, Context.NONE); } /** @@ -488,8 +582,10 @@ public SyncPoller, DomainResourceInner> beginCre public SyncPoller, DomainResourceInner> beginCreateOrUpdate( String resourceGroupName, String emailServiceName, String domainName, DomainResourceInner parameters, Context context) { - return this.beginCreateOrUpdateAsync(resourceGroupName, emailServiceName, domainName, parameters, context) - .getSyncPoller(); + Response response + = createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, parameters, context); + return this.client.getLroResult(response, DomainResourceInner.class, + DomainResourceInner.class, context); } /** @@ -513,28 +609,6 @@ private Mono createOrUpdateAsync(String resourceGroupName, .flatMap(this.client::getLroFinalResultOrError); } - /** - * Create Or Update - * - * Add a new Domains resource under the parent EmailService resource or update an existing Domains resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param domainName The name of the Domains resource. - * @param parameters Parameters for the create or update operation. - * @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 class representing a Domains resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String emailServiceName, - String domainName, DomainResourceInner parameters, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, emailServiceName, domainName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Create Or Update * @@ -552,7 +626,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, @ServiceMethod(returns = ReturnType.SINGLE) public DomainResourceInner createOrUpdate(String resourceGroupName, String emailServiceName, String domainName, DomainResourceInner parameters) { - return createOrUpdateAsync(resourceGroupName, emailServiceName, domainName, parameters).block(); + return beginCreateOrUpdate(resourceGroupName, emailServiceName, domainName, parameters).getFinalResult(); } /** @@ -573,7 +647,8 @@ public DomainResourceInner createOrUpdate(String resourceGroupName, String email @ServiceMethod(returns = ReturnType.SINGLE) public DomainResourceInner createOrUpdate(String resourceGroupName, String emailServiceName, String domainName, DomainResourceInner parameters, Context context) { - return createOrUpdateAsync(resourceGroupName, emailServiceName, domainName, parameters, context).block(); + return beginCreateOrUpdate(resourceGroupName, emailServiceName, domainName, parameters, context) + .getFinalResult(); } /** @@ -626,38 +701,39 @@ private Mono>> deleteWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains 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 Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String emailServiceName, - String domainName, Context context) { + private Response deleteWithResponse(String resourceGroupName, String emailServiceName, + String domainName) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); } if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, emailServiceName, domainName, accept, context); + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, accept, Context.NONE); } /** @@ -668,18 +744,40 @@ private Mono>> deleteWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains 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 PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String emailServiceName, - String domainName) { - Mono>> mono - = deleteWithResponseAsync(resourceGroupName, emailServiceName, domainName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String emailServiceName, + String domainName, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, accept, context); } /** @@ -690,7 +788,6 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains 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. @@ -698,12 +795,11 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String emailServiceName, - String domainName, Context context) { - context = this.client.mergeContext(context); + String domainName) { Mono>> mono - = deleteWithResponseAsync(resourceGroupName, emailServiceName, domainName, context); + = deleteWithResponseAsync(resourceGroupName, emailServiceName, domainName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -722,7 +818,8 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String emailServiceName, String domainName) { - return this.beginDeleteAsync(resourceGroupName, emailServiceName, domainName).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, emailServiceName, domainName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -742,7 +839,8 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String emailServiceName, String domainName, Context context) { - return this.beginDeleteAsync(resourceGroupName, emailServiceName, domainName, context).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, emailServiceName, domainName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -764,27 +862,6 @@ private Mono deleteAsync(String resourceGroupName, String emailServiceName .flatMap(this.client::getLroFinalResultOrError); } - /** - * Delete - * - * Operation to delete a Domains resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param domainName The name of the Domains 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 A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String emailServiceName, String domainName, - Context context) { - return beginDeleteAsync(resourceGroupName, emailServiceName, domainName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Delete * @@ -799,7 +876,7 @@ private Mono deleteAsync(String resourceGroupName, String emailServiceName */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String emailServiceName, String domainName) { - deleteAsync(resourceGroupName, emailServiceName, domainName).block(); + beginDelete(resourceGroupName, emailServiceName, domainName).getFinalResult(); } /** @@ -817,7 +894,7 @@ public void delete(String resourceGroupName, String emailServiceName, String dom */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String emailServiceName, String domainName, Context context) { - deleteAsync(resourceGroupName, emailServiceName, domainName, context).block(); + beginDelete(resourceGroupName, emailServiceName, domainName, context).getFinalResult(); } /** @@ -879,44 +956,46 @@ private Mono>> updateWithResponseAsync(String resource * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Parameters for the update operation. - * @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 class representing a Domains resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return a class representing a Domains resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync(String resourceGroupName, String emailServiceName, - String domainName, UpdateDomainRequestParameters parameters, Context context) { + private Response updateWithResponse(String resourceGroupName, String emailServiceName, + String domainName, UpdateDomainRequestParameters parameters) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); } if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, emailServiceName, domainName, parameters, accept, context); + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, parameters, accept, + Context.NONE); } /** @@ -928,18 +1007,47 @@ private Mono>> updateWithResponseAsync(String resource * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Parameters for the update operation. + * @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 a class representing a Domains resource. + * @return a class representing a Domains resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DomainResourceInner> beginUpdateAsync(String resourceGroupName, - String emailServiceName, String domainName, UpdateDomainRequestParameters parameters) { - Mono>> mono - = updateWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - DomainResourceInner.class, DomainResourceInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String emailServiceName, + String domainName, UpdateDomainRequestParameters 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName 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 accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, parameters, accept, + context); } /** @@ -951,7 +1059,6 @@ private PollerFlux, DomainResourceInner> beginUp * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Parameters for the update operation. - * @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. @@ -959,12 +1066,11 @@ private PollerFlux, DomainResourceInner> beginUp */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, DomainResourceInner> beginUpdateAsync(String resourceGroupName, - String emailServiceName, String domainName, UpdateDomainRequestParameters parameters, Context context) { - context = this.client.mergeContext(context); + String emailServiceName, String domainName, UpdateDomainRequestParameters parameters) { Mono>> mono - = updateWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters, context); + = updateWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - DomainResourceInner.class, DomainResourceInner.class, context); + DomainResourceInner.class, DomainResourceInner.class, this.client.getContext()); } /** @@ -984,7 +1090,9 @@ private PollerFlux, DomainResourceInner> beginUp @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DomainResourceInner> beginUpdate(String resourceGroupName, String emailServiceName, String domainName, UpdateDomainRequestParameters parameters) { - return this.beginUpdateAsync(resourceGroupName, emailServiceName, domainName, parameters).getSyncPoller(); + Response response = updateWithResponse(resourceGroupName, emailServiceName, domainName, parameters); + return this.client.getLroResult(response, DomainResourceInner.class, + DomainResourceInner.class, Context.NONE); } /** @@ -1005,8 +1113,10 @@ public SyncPoller, DomainResourceInner> beginUpd @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DomainResourceInner> beginUpdate(String resourceGroupName, String emailServiceName, String domainName, UpdateDomainRequestParameters parameters, Context context) { - return this.beginUpdateAsync(resourceGroupName, emailServiceName, domainName, parameters, context) - .getSyncPoller(); + Response response + = updateWithResponse(resourceGroupName, emailServiceName, domainName, parameters, context); + return this.client.getLroResult(response, DomainResourceInner.class, + DomainResourceInner.class, context); } /** @@ -1030,28 +1140,6 @@ private Mono updateAsync(String resourceGroupName, String e .flatMap(this.client::getLroFinalResultOrError); } - /** - * Update - * - * Operation to update an existing Domains resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param domainName The name of the Domains resource. - * @param parameters Parameters for the update operation. - * @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 class representing a Domains resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String emailServiceName, String domainName, - UpdateDomainRequestParameters parameters, Context context) { - return beginUpdateAsync(resourceGroupName, emailServiceName, domainName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Update * @@ -1069,7 +1157,7 @@ private Mono updateAsync(String resourceGroupName, String e @ServiceMethod(returns = ReturnType.SINGLE) public DomainResourceInner update(String resourceGroupName, String emailServiceName, String domainName, UpdateDomainRequestParameters parameters) { - return updateAsync(resourceGroupName, emailServiceName, domainName, parameters).block(); + return beginUpdate(resourceGroupName, emailServiceName, domainName, parameters).getFinalResult(); } /** @@ -1090,7 +1178,7 @@ public DomainResourceInner update(String resourceGroupName, String emailServiceN @ServiceMethod(returns = ReturnType.SINGLE) public DomainResourceInner update(String resourceGroupName, String emailServiceName, String domainName, UpdateDomainRequestParameters parameters, Context context) { - return updateAsync(resourceGroupName, emailServiceName, domainName, parameters, context).block(); + return beginUpdate(resourceGroupName, emailServiceName, domainName, parameters, context).getFinalResult(); } /** @@ -1142,39 +1230,17 @@ private Mono> listByEmailServiceResourceSingl * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService 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 object that includes an array of Domains resource and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return object that includes an array of Domains resource and a possible link for next set as paginated response + * with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEmailServiceResourceSinglePageAsync(String resourceGroupName, - String emailServiceName, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByEmailServiceResource(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, emailServiceName, 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 listByEmailServiceResourceAsync(String resourceGroupName, + String emailServiceName) { + return new PagedFlux<>(() -> listByEmailServiceResourceSinglePageAsync(resourceGroupName, emailServiceName), + nextLink -> listByEmailServiceResourceNextSinglePageAsync(nextLink)); } /** @@ -1187,14 +1253,36 @@ private Mono> listByEmailServiceResourceSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return object that includes an array of Domains resource and a possible link for next set as paginated response - * with {@link PagedFlux}. + * @return object that includes an array of Domains resource and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByEmailServiceResourceAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEmailServiceResourceSinglePage(String resourceGroupName, String emailServiceName) { - return new PagedFlux<>(() -> listByEmailServiceResourceSinglePageAsync(resourceGroupName, emailServiceName), - nextLink -> listByEmailServiceResourceNextSinglePageAsync(nextLink)); + 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEmailServiceResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1208,15 +1296,36 @@ private PagedFlux listByEmailServiceResourceAsync(String re * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return object that includes an array of Domains resource and a possible link for next set as paginated response - * with {@link PagedFlux}. + * @return object that includes an array of Domains resource and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByEmailServiceResourceAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEmailServiceResourceSinglePage(String resourceGroupName, String emailServiceName, Context context) { - return new PagedFlux<>( - () -> listByEmailServiceResourceSinglePageAsync(resourceGroupName, emailServiceName, context), - nextLink -> listByEmailServiceResourceNextSinglePageAsync(nextLink, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEmailServiceResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1235,7 +1344,8 @@ private PagedFlux listByEmailServiceResourceAsync(String re @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByEmailServiceResource(String resourceGroupName, String emailServiceName) { - return new PagedIterable<>(listByEmailServiceResourceAsync(resourceGroupName, emailServiceName)); + return new PagedIterable<>(() -> listByEmailServiceResourceSinglePage(resourceGroupName, emailServiceName), + nextLink -> listByEmailServiceResourceNextSinglePage(nextLink)); } /** @@ -1255,7 +1365,9 @@ public PagedIterable listByEmailServiceResource(String reso @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByEmailServiceResource(String resourceGroupName, String emailServiceName, Context context) { - return new PagedIterable<>(listByEmailServiceResourceAsync(resourceGroupName, emailServiceName, context)); + return new PagedIterable<>( + () -> listByEmailServiceResourceSinglePage(resourceGroupName, emailServiceName, context), + nextLink -> listByEmailServiceResourceNextSinglePage(nextLink, context)); } /** @@ -1316,44 +1428,46 @@ private Mono>> initiateVerificationWithResponseAsync(S * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Type of verification to be initiated. - * @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 response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> initiateVerificationWithResponseAsync(String resourceGroupName, - String emailServiceName, String domainName, VerificationParameter parameters, Context context) { + private Response initiateVerificationWithResponse(String resourceGroupName, String emailServiceName, + String domainName, VerificationParameter parameters) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); } if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.initiateVerification(this.client.getEndpoint(), this.client.getApiVersion(), + return service.initiateVerificationSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, parameters, accept, - context); + Context.NONE); } /** @@ -1365,18 +1479,47 @@ private Mono>> initiateVerificationWithResponseAsync(S * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Type of verification to be initiated. + * @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. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginInitiateVerificationAsync(String resourceGroupName, - String emailServiceName, String domainName, VerificationParameter parameters) { - Mono>> mono - = initiateVerificationWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response initiateVerificationWithResponse(String resourceGroupName, String emailServiceName, + String domainName, VerificationParameter 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName 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 accept = "application/json"; + return service.initiateVerificationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, parameters, accept, + context); } /** @@ -1388,7 +1531,6 @@ private PollerFlux, Void> beginInitiateVerificationAsync(String * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Type of verification to be initiated. - * @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. @@ -1396,12 +1538,11 @@ private PollerFlux, Void> beginInitiateVerificationAsync(String */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginInitiateVerificationAsync(String resourceGroupName, - String emailServiceName, String domainName, VerificationParameter parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = initiateVerificationWithResponseAsync(resourceGroupName, - emailServiceName, domainName, parameters, context); + String emailServiceName, String domainName, VerificationParameter parameters) { + Mono>> mono + = initiateVerificationWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -1421,8 +1562,9 @@ private PollerFlux, Void> beginInitiateVerificationAsync(String @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginInitiateVerification(String resourceGroupName, String emailServiceName, String domainName, VerificationParameter parameters) { - return this.beginInitiateVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters) - .getSyncPoller(); + Response response + = initiateVerificationWithResponse(resourceGroupName, emailServiceName, domainName, parameters); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -1443,8 +1585,9 @@ public SyncPoller, Void> beginInitiateVerification(String resou @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginInitiateVerification(String resourceGroupName, String emailServiceName, String domainName, VerificationParameter parameters, Context context) { - return this.beginInitiateVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters, context) - .getSyncPoller(); + Response response + = initiateVerificationWithResponse(resourceGroupName, emailServiceName, domainName, parameters, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -1468,29 +1611,6 @@ private Mono initiateVerificationAsync(String resourceGroupName, String em .flatMap(this.client::getLroFinalResultOrError); } - /** - * Initiate Verification - * - * Initiate verification of DNS record. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param domainName The name of the Domains resource. - * @param parameters Type of verification to be initiated. - * @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 initiateVerificationAsync(String resourceGroupName, String emailServiceName, String domainName, - VerificationParameter parameters, Context context) { - return beginInitiateVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Initiate Verification * @@ -1507,7 +1627,7 @@ private Mono initiateVerificationAsync(String resourceGroupName, String em @ServiceMethod(returns = ReturnType.SINGLE) public void initiateVerification(String resourceGroupName, String emailServiceName, String domainName, VerificationParameter parameters) { - initiateVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters).block(); + beginInitiateVerification(resourceGroupName, emailServiceName, domainName, parameters).getFinalResult(); } /** @@ -1527,7 +1647,8 @@ public void initiateVerification(String resourceGroupName, String emailServiceNa @ServiceMethod(returns = ReturnType.SINGLE) public void initiateVerification(String resourceGroupName, String emailServiceName, String domainName, VerificationParameter parameters, Context context) { - initiateVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters, context).block(); + beginInitiateVerification(resourceGroupName, emailServiceName, domainName, parameters, context) + .getFinalResult(); } /** @@ -1588,44 +1709,46 @@ private Mono>> cancelVerificationWithResponseAsync(Str * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Type of verification to be canceled. - * @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 response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> cancelVerificationWithResponseAsync(String resourceGroupName, - String emailServiceName, String domainName, VerificationParameter parameters, Context context) { + private Response cancelVerificationWithResponse(String resourceGroupName, String emailServiceName, + String domainName, VerificationParameter parameters) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); } if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.cancelVerification(this.client.getEndpoint(), this.client.getApiVersion(), + return service.cancelVerificationSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, parameters, accept, - context); + Context.NONE); } /** @@ -1637,18 +1760,47 @@ private Mono>> cancelVerificationWithResponseAsync(Str * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Type of verification to be canceled. + * @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. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginCancelVerificationAsync(String resourceGroupName, - String emailServiceName, String domainName, VerificationParameter parameters) { - Mono>> mono - = cancelVerificationWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response cancelVerificationWithResponse(String resourceGroupName, String emailServiceName, + String domainName, VerificationParameter 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName 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 accept = "application/json"; + return service.cancelVerificationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, parameters, accept, + context); } /** @@ -1660,7 +1812,6 @@ private PollerFlux, Void> beginCancelVerificationAsync(String r * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains resource. * @param parameters Type of verification to be canceled. - * @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. @@ -1668,12 +1819,11 @@ private PollerFlux, Void> beginCancelVerificationAsync(String r */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginCancelVerificationAsync(String resourceGroupName, - String emailServiceName, String domainName, VerificationParameter parameters, Context context) { - context = this.client.mergeContext(context); + String emailServiceName, String domainName, VerificationParameter parameters) { Mono>> mono - = cancelVerificationWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters, context); + = cancelVerificationWithResponseAsync(resourceGroupName, emailServiceName, domainName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -1693,8 +1843,9 @@ private PollerFlux, Void> beginCancelVerificationAsync(String r @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginCancelVerification(String resourceGroupName, String emailServiceName, String domainName, VerificationParameter parameters) { - return this.beginCancelVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters) - .getSyncPoller(); + Response response + = cancelVerificationWithResponse(resourceGroupName, emailServiceName, domainName, parameters); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -1715,8 +1866,9 @@ public SyncPoller, Void> beginCancelVerification(String resourc @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginCancelVerification(String resourceGroupName, String emailServiceName, String domainName, VerificationParameter parameters, Context context) { - return this.beginCancelVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters, context) - .getSyncPoller(); + Response response + = cancelVerificationWithResponse(resourceGroupName, emailServiceName, domainName, parameters, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -1740,28 +1892,6 @@ private Mono cancelVerificationAsync(String resourceGroupName, String emai .flatMap(this.client::getLroFinalResultOrError); } - /** - * Cancel Verification - * - * Cancel verification of DNS record. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param domainName The name of the Domains resource. - * @param parameters Type of verification to be canceled. - * @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 cancelVerificationAsync(String resourceGroupName, String emailServiceName, String domainName, - VerificationParameter parameters, Context context) { - return beginCancelVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Cancel Verification * @@ -1778,7 +1908,7 @@ private Mono cancelVerificationAsync(String resourceGroupName, String emai @ServiceMethod(returns = ReturnType.SINGLE) public void cancelVerification(String resourceGroupName, String emailServiceName, String domainName, VerificationParameter parameters) { - cancelVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters).block(); + beginCancelVerification(resourceGroupName, emailServiceName, domainName, parameters).getFinalResult(); } /** @@ -1798,10 +1928,12 @@ public void cancelVerification(String resourceGroupName, String emailServiceName @ServiceMethod(returns = ReturnType.SINGLE) public void cancelVerification(String resourceGroupName, String emailServiceName, String domainName, VerificationParameter parameters, Context context) { - cancelVerificationAsync(resourceGroupName, emailServiceName, domainName, parameters, context).block(); + beginCancelVerification(resourceGroupName, emailServiceName, domainName, parameters, context).getFinalResult(); } /** + * List by EmailService + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1830,6 +1962,38 @@ private Mono> listByEmailServiceResourceNextS } /** + * List by EmailService + * + * 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 object that includes an array of Domains resource and a possible link for next set along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEmailServiceResourceNextSinglePage(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.listByEmailServiceResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List by EmailService + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1838,22 +2002,26 @@ private Mono> listByEmailServiceResourceNextS * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return object that includes an array of Domains resource and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEmailServiceResourceNextSinglePageAsync(String nextLink, + private PagedResponse listByEmailServiceResourceNextSinglePage(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.listByEmailServiceResourceNext(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.listByEmailServiceResourceNextSync(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(DomainsClientImpl.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServiceResourceImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServiceResourceImpl.java index 359cd5151d24..9e163edee634 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServiceResourceImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServiceResourceImpl.java @@ -177,6 +177,6 @@ public EmailServiceResourceImpl withDataLocation(String dataLocation) { } private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServicesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServicesClientImpl.java index 0fc971e7ad12..8221782bfdcd 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServicesClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServicesClientImpl.java @@ -29,8 +29,10 @@ 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.communication.fluent.EmailServicesClient; @@ -72,7 +74,7 @@ public final class EmailServicesClientImpl implements EmailServicesClient { * proxy service to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "CommunicationService") + @ServiceInterface(name = "CommunicationServiceManagementClientEmailServices") public interface EmailServicesService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}") @@ -84,6 +86,16 @@ Mono> getByResourceGroup(@HostParam("$host") @PathParam("emailServiceName") String emailServiceName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}") @ExpectedResponses({ 200, 201 }) @@ -95,6 +107,17 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @BodyParam("application/json") EmailServiceResourceInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, + @BodyParam("application/json") EmailServiceResourceInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}") @ExpectedResponses({ 200, 202, 204 }) @@ -105,6 +128,16 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("emailServiceName") String emailServiceName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}") @ExpectedResponses({ 200, 201 }) @@ -116,6 +149,17 @@ Mono>> update(@HostParam("$host") String endpoint, @BodyParam("application/json") EmailServiceResourceUpdate parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, + @BodyParam("application/json") EmailServiceResourceUpdate parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/emailServices") @ExpectedResponses({ 200 }) @@ -124,6 +168,14 @@ Mono> list(@HostParam("$host") String endpoin @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/emailServices") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @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.Communication/emailServices") @ExpectedResponses({ 200 }) @@ -133,6 +185,15 @@ Mono> listByResourceGroup(@HostParam("$host") @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/listVerifiedExchangeOnlineDomains") @ExpectedResponses({ 200 }) @@ -141,6 +202,14 @@ Mono>> listVerifiedExchangeOnlineDomains(@HostParam("$host @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/listVerifiedExchangeOnlineDomains") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response> listVerifiedExchangeOnlineDomainsSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -149,6 +218,14 @@ Mono> listBySubscriptionNext( @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) + Response listBySubscriptionNextSync( + @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 }) @@ -156,6 +233,14 @@ Mono> listBySubscriptionNext( Mono> listByResourceGroupNext( @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) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -196,44 +281,6 @@ private Mono> getByResourceGroupWithResponse .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get - * - * Get the EmailService and its properties. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService 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 EmailService and its properties along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String emailServiceName, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, emailServiceName, accept, context); - } - /** * Get * @@ -268,7 +315,27 @@ private Mono getByResourceGroupAsync(String resourceG @ServiceMethod(returns = ReturnType.SINGLE) public Response getByResourceGroupWithResponse(String resourceGroupName, String emailServiceName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, emailServiceName, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, accept, context); } /** @@ -341,41 +408,41 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param parameters Parameters for the create or update operation. - * @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 class representing an EmailService resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return a class representing an EmailService resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String emailServiceName, EmailServiceResourceInner parameters, Context context) { + private Response createOrUpdateWithResponse(String resourceGroupName, String emailServiceName, + EmailServiceResourceInner parameters) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, emailServiceName, parameters, accept, context); + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, parameters, accept, Context.NONE); } /** @@ -386,19 +453,42 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param parameters Parameters for the create or update operation. + * @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 a class representing an EmailService resource. + * @return a class representing an EmailService resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, EmailServiceResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String emailServiceName, EmailServiceResourceInner parameters) { - Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), EmailServiceResourceInner.class, EmailServiceResourceInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String emailServiceName, + EmailServiceResourceInner 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName 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 accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, parameters, accept, context); } /** @@ -409,7 +499,6 @@ private PollerFlux, EmailServiceResourceIn * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param parameters Parameters for the create or update operation. - * @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. @@ -417,12 +506,12 @@ private PollerFlux, EmailServiceResourceIn */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, EmailServiceResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String emailServiceName, EmailServiceResourceInner parameters, Context context) { - context = this.client.mergeContext(context); + String resourceGroupName, String emailServiceName, EmailServiceResourceInner parameters) { Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, parameters, context); + = createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), EmailServiceResourceInner.class, EmailServiceResourceInner.class, context); + this.client.getHttpPipeline(), EmailServiceResourceInner.class, EmailServiceResourceInner.class, + this.client.getContext()); } /** @@ -441,7 +530,9 @@ private PollerFlux, EmailServiceResourceIn @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, EmailServiceResourceInner> beginCreateOrUpdate(String resourceGroupName, String emailServiceName, EmailServiceResourceInner parameters) { - return this.beginCreateOrUpdateAsync(resourceGroupName, emailServiceName, parameters).getSyncPoller(); + Response response = createOrUpdateWithResponse(resourceGroupName, emailServiceName, parameters); + return this.client.getLroResult(response, + EmailServiceResourceInner.class, EmailServiceResourceInner.class, Context.NONE); } /** @@ -461,7 +552,10 @@ private PollerFlux, EmailServiceResourceIn @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, EmailServiceResourceInner> beginCreateOrUpdate( String resourceGroupName, String emailServiceName, EmailServiceResourceInner parameters, Context context) { - return this.beginCreateOrUpdateAsync(resourceGroupName, emailServiceName, parameters, context).getSyncPoller(); + Response response + = createOrUpdateWithResponse(resourceGroupName, emailServiceName, parameters, context); + return this.client.getLroResult(response, + EmailServiceResourceInner.class, EmailServiceResourceInner.class, context); } /** @@ -484,27 +578,6 @@ private Mono createOrUpdateAsync(String resourceGroup .flatMap(this.client::getLroFinalResultOrError); } - /** - * Create Or Update - * - * Create a new EmailService or update an existing EmailService. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param parameters Parameters for the create or update operation. - * @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 class representing an EmailService resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String emailServiceName, - EmailServiceResourceInner parameters, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, emailServiceName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Create Or Update * @@ -521,7 +594,7 @@ private Mono createOrUpdateAsync(String resourceGroup @ServiceMethod(returns = ReturnType.SINGLE) public EmailServiceResourceInner createOrUpdate(String resourceGroupName, String emailServiceName, EmailServiceResourceInner parameters) { - return createOrUpdateAsync(resourceGroupName, emailServiceName, parameters).block(); + return beginCreateOrUpdate(resourceGroupName, emailServiceName, parameters).getFinalResult(); } /** @@ -541,7 +614,7 @@ public EmailServiceResourceInner createOrUpdate(String resourceGroupName, String @ServiceMethod(returns = ReturnType.SINGLE) public EmailServiceResourceInner createOrUpdate(String resourceGroupName, String emailServiceName, EmailServiceResourceInner parameters, Context context) { - return createOrUpdateAsync(resourceGroupName, emailServiceName, parameters, context).block(); + return beginCreateOrUpdate(resourceGroupName, emailServiceName, parameters, context).getFinalResult(); } /** @@ -589,35 +662,34 @@ private Mono>> deleteWithResponseAsync(String resource * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService 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 Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String emailServiceName, - Context context) { + private Response deleteWithResponse(String resourceGroupName, String emailServiceName) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, emailServiceName, accept, context); + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, accept, Context.NONE); } /** @@ -627,16 +699,36 @@ private Mono>> deleteWithResponseAsync(String resource * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService 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 PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String emailServiceName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, emailServiceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String emailServiceName, + 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, accept, context); } /** @@ -646,19 +738,16 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService 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 PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String emailServiceName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = deleteWithResponseAsync(resourceGroupName, emailServiceName, context); + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String emailServiceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, emailServiceName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -675,7 +764,8 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String emailServiceName) { - return this.beginDeleteAsync(resourceGroupName, emailServiceName).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, emailServiceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -694,7 +784,8 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String emailServiceName, Context context) { - return this.beginDeleteAsync(resourceGroupName, emailServiceName, context).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, emailServiceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -715,25 +806,6 @@ private Mono deleteAsync(String resourceGroupName, String emailServiceName .flatMap(this.client::getLroFinalResultOrError); } - /** - * Delete - * - * Operation to delete a EmailService. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService 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 A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String emailServiceName, Context context) { - return beginDeleteAsync(resourceGroupName, emailServiceName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Delete * @@ -747,7 +819,7 @@ private Mono deleteAsync(String resourceGroupName, String emailServiceName */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String emailServiceName) { - deleteAsync(resourceGroupName, emailServiceName).block(); + beginDelete(resourceGroupName, emailServiceName).getFinalResult(); } /** @@ -764,7 +836,7 @@ public void delete(String resourceGroupName, String emailServiceName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String emailServiceName, Context context) { - deleteAsync(resourceGroupName, emailServiceName, context).block(); + beginDelete(resourceGroupName, emailServiceName, context).getFinalResult(); } /** @@ -820,41 +892,41 @@ private Mono>> updateWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param parameters Parameters for the update operation. - * @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 class representing an EmailService resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return a class representing an EmailService resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync(String resourceGroupName, String emailServiceName, - EmailServiceResourceUpdate parameters, Context context) { + private Response updateWithResponse(String resourceGroupName, String emailServiceName, + EmailServiceResourceUpdate parameters) { 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) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, emailServiceName, parameters, accept, context); + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, parameters, accept, Context.NONE); } /** @@ -865,19 +937,42 @@ private Mono>> updateWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param parameters Parameters for the update operation. + * @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 a class representing an EmailService resource. + * @return a class representing an EmailService resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, EmailServiceResourceInner> - beginUpdateAsync(String resourceGroupName, String emailServiceName, EmailServiceResourceUpdate parameters) { - Mono>> mono - = updateWithResponseAsync(resourceGroupName, emailServiceName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), EmailServiceResourceInner.class, EmailServiceResourceInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String emailServiceName, + EmailServiceResourceUpdate 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName 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 accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, parameters, accept, context); } /** @@ -888,20 +983,19 @@ private Mono>> updateWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param parameters Parameters for the update operation. - * @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 a class representing an EmailService resource. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, EmailServiceResourceInner> beginUpdateAsync( - String resourceGroupName, String emailServiceName, EmailServiceResourceUpdate parameters, Context context) { - context = this.client.mergeContext(context); + private PollerFlux, EmailServiceResourceInner> + beginUpdateAsync(String resourceGroupName, String emailServiceName, EmailServiceResourceUpdate parameters) { Mono>> mono - = updateWithResponseAsync(resourceGroupName, emailServiceName, parameters, context); + = updateWithResponseAsync(resourceGroupName, emailServiceName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), EmailServiceResourceInner.class, EmailServiceResourceInner.class, context); + this.client.getHttpPipeline(), EmailServiceResourceInner.class, EmailServiceResourceInner.class, + this.client.getContext()); } /** @@ -920,7 +1014,9 @@ private PollerFlux, EmailServiceResourceIn @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, EmailServiceResourceInner> beginUpdate(String resourceGroupName, String emailServiceName, EmailServiceResourceUpdate parameters) { - return this.beginUpdateAsync(resourceGroupName, emailServiceName, parameters).getSyncPoller(); + Response response = updateWithResponse(resourceGroupName, emailServiceName, parameters); + return this.client.getLroResult(response, + EmailServiceResourceInner.class, EmailServiceResourceInner.class, Context.NONE); } /** @@ -940,7 +1036,9 @@ private PollerFlux, EmailServiceResourceIn @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, EmailServiceResourceInner> beginUpdate( String resourceGroupName, String emailServiceName, EmailServiceResourceUpdate parameters, Context context) { - return this.beginUpdateAsync(resourceGroupName, emailServiceName, parameters, context).getSyncPoller(); + Response response = updateWithResponse(resourceGroupName, emailServiceName, parameters, context); + return this.client.getLroResult(response, + EmailServiceResourceInner.class, EmailServiceResourceInner.class, context); } /** @@ -963,27 +1061,6 @@ private Mono updateAsync(String resourceGroupName, St .flatMap(this.client::getLroFinalResultOrError); } - /** - * Update - * - * Operation to update an existing EmailService. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param parameters Parameters for the update operation. - * @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 class representing an EmailService resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String emailServiceName, - EmailServiceResourceUpdate parameters, Context context) { - return beginUpdateAsync(resourceGroupName, emailServiceName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Update * @@ -1000,7 +1077,7 @@ private Mono updateAsync(String resourceGroupName, St @ServiceMethod(returns = ReturnType.SINGLE) public EmailServiceResourceInner update(String resourceGroupName, String emailServiceName, EmailServiceResourceUpdate parameters) { - return updateAsync(resourceGroupName, emailServiceName, parameters).block(); + return beginUpdate(resourceGroupName, emailServiceName, parameters).getFinalResult(); } /** @@ -1020,7 +1097,7 @@ public EmailServiceResourceInner update(String resourceGroupName, String emailSe @ServiceMethod(returns = ReturnType.SINGLE) public EmailServiceResourceInner update(String resourceGroupName, String emailServiceName, EmailServiceResourceUpdate parameters, Context context) { - return updateAsync(resourceGroupName, emailServiceName, parameters, context).block(); + return beginUpdate(resourceGroupName, emailServiceName, parameters, context).getFinalResult(); } /** @@ -1057,30 +1134,15 @@ private Mono> listSinglePageAsync() { * * Handles requests to list all resources in a 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 object that includes an array of EmailServices and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return object that includes an array of EmailServices and a possible link for next set 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.")); - } - 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** @@ -1090,13 +1152,26 @@ private Mono> listSinglePageAsync(Conte * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return object that includes an array of EmailServices and a possible link for next set as paginated response - * with {@link PagedFlux}. + * @return object that includes an array of EmailServices and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(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.")); + } + 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(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1108,13 +1183,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return object that includes an array of EmailServices and a possible link for next set as paginated response - * with {@link PagedFlux}. + * @return object that includes an array of EmailServices and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(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.")); + } + 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(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1129,7 +1217,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); } /** @@ -1146,7 +1234,8 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); } /** @@ -1191,35 +1280,16 @@ public PagedIterable list(Context context) { * Handles requests to list all resources in a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @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 object that includes an array of EmailServices and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return object that includes an array of EmailServices and a possible link for next set as paginated response + * with {@link PagedFlux}. */ - @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 (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"; - context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, 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 listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** @@ -1231,13 +1301,30 @@ private Mono> listByResourceGroupSingle * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return object that includes an array of EmailServices and a possible link for next set as paginated response - * with {@link PagedFlux}. + * @return object that includes an array of EmailServices and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + 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, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1250,13 +1337,31 @@ private PagedFlux listByResourceGroupAsync(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return object that includes an array of EmailServices and a possible link for next set as paginated response - * with {@link PagedFlux}. + * @return object that includes an array of EmailServices and a possible link for next set along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + 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, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1273,7 +1378,8 @@ private PagedFlux listByResourceGroupAsync(String res */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); } /** @@ -1291,7 +1397,8 @@ public PagedIterable listByResourceGroup(String resou */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); } /** @@ -1321,34 +1428,6 @@ private Mono>> listVerifiedExchangeOnlineDomainsWithRespon .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * List Verified Domains From Exchange Online - * - * Get a list of domains that are fully verified in Exchange Online. - * - * @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 list of domains that are fully verified in Exchange Online along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> listVerifiedExchangeOnlineDomainsWithResponseAsync(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.listVerifiedExchangeOnlineDomains(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context); - } - /** * List Verified Domains From Exchange Online * @@ -1376,7 +1455,19 @@ private Mono> listVerifiedExchangeOnlineDomainsAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response> listVerifiedExchangeOnlineDomainsWithResponse(Context context) { - return listVerifiedExchangeOnlineDomainsWithResponseAsync(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.")); + } + final String accept = "application/json"; + return service.listVerifiedExchangeOnlineDomainsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); } /** @@ -1394,6 +1485,8 @@ public List listVerifiedExchangeOnlineDomains() { } /** + * List By Subscription + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1422,6 +1515,38 @@ private Mono> listBySubscriptionNextSin } /** + * List By Subscription + * + * 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 object that includes an array of EmailServices and a possible link for next set along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(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.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List By Subscription + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1430,26 +1555,30 @@ private Mono> listBySubscriptionNextSin * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return object that includes an array of EmailServices and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + private PagedResponse listBySubscriptionNextSinglePage(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.listBySubscriptionNext(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.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** + * List By Resource Group + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1478,6 +1607,38 @@ private Mono> listByResourceGroupNextSi } /** + * List By Resource Group + * + * 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 object that includes an array of EmailServices and a possible link for next set along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(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.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List By Resource Group + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1486,22 +1647,26 @@ private Mono> listByResourceGroupNextSi * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return object that includes an array of EmailServices and a possible link for next set along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + private PagedResponse listByResourceGroupNextSinglePage(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.listByResourceGroupNext(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.listByResourceGroupNextSync(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(EmailServicesClientImpl.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java index 8002773a39b5..3b186ea36866 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java @@ -25,6 +25,7 @@ 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.communication.fluent.OperationsClient; import com.azure.resourcemanager.communication.fluent.models.OperationInner; import com.azure.resourcemanager.communication.models.OperationListResult; @@ -60,7 +61,7 @@ public final class OperationsClientImpl implements OperationsClient { * proxy service to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "CommunicationService") + @ServiceInterface(name = "CommunicationServiceManagementClientOperations") public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Communication/operations") @@ -69,12 +70,26 @@ public interface OperationsService { Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Communication/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @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) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -107,24 +122,14 @@ private Mono> listSinglePageAsync() { * * Lists all of the available REST API operations of the Microsoft.Communication 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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return a list of REST API operations supported by an Azure Resource Provider 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)); } /** @@ -134,12 +139,20 @@ private Mono> listSinglePageAsync(Context context) * * @throws 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 list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedFlux}. + * @return a list of REST API operations supported by an Azure Resource Provider 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); } /** @@ -151,13 +164,20 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedFlux}. + * @return a list of REST API operations supported by an Azure Resource Provider 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); } /** @@ -172,7 +192,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -189,10 +209,12 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** + * List Operations + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -219,6 +241,37 @@ private Mono> listNextSinglePageAsync(String nextL } /** + * List Operations + * + * 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 a list of REST API operations supported by an Azure Resource Provider 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); + } + + /** + * List Operations + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -226,22 +279,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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return a list of REST API operations supported by an Azure Resource Provider 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/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SenderUsernamesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SenderUsernamesClientImpl.java index ee4400957264..e9e64701e2f7 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SenderUsernamesClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SenderUsernamesClientImpl.java @@ -28,6 +28,7 @@ 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.communication.fluent.SenderUsernamesClient; import com.azure.resourcemanager.communication.fluent.models.SenderUsernameResourceInner; import com.azure.resourcemanager.communication.models.SenderUsernameResourceCollection; @@ -63,7 +64,7 @@ public final class SenderUsernamesClientImpl implements SenderUsernamesClient { * proxy service to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "CommunicationService") + @ServiceInterface(name = "CommunicationServiceManagementClientSenderUsernames") public interface SenderUsernamesService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames") @@ -75,6 +76,16 @@ Mono> listByDomains(@HostParam("$host @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByDomainsSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}") @ExpectedResponses({ 200 }) @@ -85,6 +96,16 @@ Mono> get(@HostParam("$host") String endpo @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, @PathParam("senderUsername") String senderUsername, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("senderUsername") String senderUsername, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}") @ExpectedResponses({ 200, 201 }) @@ -97,6 +118,18 @@ Mono> createOrUpdate(@HostParam("$host") S @BodyParam("application/json") SenderUsernameResourceInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("senderUsername") String senderUsername, + @BodyParam("application/json") SenderUsernameResourceInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}") @ExpectedResponses({ 200, 204 }) @@ -107,6 +140,16 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, @PathParam("senderUsername") String senderUsername, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("senderUsername") String senderUsername, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -114,6 +157,14 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap Mono> listByDomainsNext( @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) + Response listByDomainsNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -169,42 +220,16 @@ private Mono> listByDomainsSinglePage * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param emailServiceName The name of the EmailService resource. * @param domainName The name of the Domains 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 a class representing a Domains SenderUsernames collection along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a class representing a Domains SenderUsernames collection as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDomainsSinglePageAsync(String resourceGroupName, - String emailServiceName, String domainName, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); - } - if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByDomains(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, emailServiceName, domainName, 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 listByDomainsAsync(String resourceGroupName, String emailServiceName, + String domainName) { + return new PagedFlux<>(() -> listByDomainsSinglePageAsync(resourceGroupName, emailServiceName, domainName), + nextLink -> listByDomainsNextSinglePageAsync(nextLink)); } /** @@ -218,13 +243,39 @@ private Mono> listByDomainsSinglePage * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 class representing a Domains SenderUsernames collection as paginated response with {@link PagedFlux}. + * @return a class representing a Domains SenderUsernames collection along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByDomainsAsync(String resourceGroupName, String emailServiceName, - String domainName) { - return new PagedFlux<>(() -> listByDomainsSinglePageAsync(resourceGroupName, emailServiceName, domainName), - nextLink -> listByDomainsNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDomainsSinglePage(String resourceGroupName, + String emailServiceName, String domainName) { + 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDomainsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -239,14 +290,39 @@ private PagedFlux listByDomainsAsync(String resourc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 class representing a Domains SenderUsernames collection as paginated response with {@link PagedFlux}. + * @return a class representing a Domains SenderUsernames collection along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByDomainsAsync(String resourceGroupName, String emailServiceName, - String domainName, Context context) { - return new PagedFlux<>( - () -> listByDomainsSinglePageAsync(resourceGroupName, emailServiceName, domainName, context), - nextLink -> listByDomainsNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDomainsSinglePage(String resourceGroupName, + String emailServiceName, String domainName, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDomainsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -266,7 +342,8 @@ private PagedFlux listByDomainsAsync(String resourc @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByDomains(String resourceGroupName, String emailServiceName, String domainName) { - return new PagedIterable<>(listByDomainsAsync(resourceGroupName, emailServiceName, domainName)); + return new PagedIterable<>(() -> listByDomainsSinglePage(resourceGroupName, emailServiceName, domainName), + nextLink -> listByDomainsNextSinglePage(nextLink)); } /** @@ -287,7 +364,9 @@ public PagedIterable listByDomains(String resourceG @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByDomains(String resourceGroupName, String emailServiceName, String domainName, Context context) { - return new PagedIterable<>(listByDomainsAsync(resourceGroupName, emailServiceName, domainName, context)); + return new PagedIterable<>( + () -> listByDomainsSinglePage(resourceGroupName, emailServiceName, domainName, context), + nextLink -> listByDomainsNextSinglePage(nextLink, context)); } /** @@ -338,53 +417,6 @@ private Mono> getWithResponseAsync(String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get - * - * Get a valid sender username for a domains resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param domainName The name of the Domains resource. - * @param senderUsername The valid sender Username. - * @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 valid sender username for a domains resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String emailServiceName, String domainName, String senderUsername, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); - } - if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); - } - if (senderUsername == null) { - return Mono.error(new IllegalArgumentException("Parameter senderUsername is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, emailServiceName, domainName, senderUsername, accept, context); - } - /** * Get * @@ -424,7 +456,35 @@ private Mono getAsync(String resourceGroupName, Str @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String emailServiceName, String domainName, String senderUsername, Context context) { - return getWithResponseAsync(resourceGroupName, emailServiceName, domainName, senderUsername, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (senderUsername == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter senderUsername is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, emailServiceName, domainName, senderUsername, accept, context); } /** @@ -503,62 +563,6 @@ private Mono> createOrUpdateWithResponseAs .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Create Or Update - * - * Add a new SenderUsername resource under the parent Domains resource or update an existing SenderUsername - * resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param domainName The name of the Domains resource. - * @param senderUsername The valid sender Username. - * @param parameters Parameters for the create or update operation. - * @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 class representing a SenderUsername resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String emailServiceName, String domainName, String senderUsername, SenderUsernameResourceInner parameters, - 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); - } - if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); - } - if (senderUsername == null) { - return Mono.error(new IllegalArgumentException("Parameter senderUsername 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(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, senderUsername, - parameters, accept, context); - } - /** * Create Or Update * @@ -603,8 +607,42 @@ private Mono createOrUpdateAsync(String resourceGro public Response createOrUpdateWithResponse(String resourceGroupName, String emailServiceName, String domainName, String senderUsername, SenderUsernameResourceInner parameters, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, domainName, senderUsername, - parameters, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (senderUsername == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter senderUsername 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 accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, senderUsername, + parameters, accept, context); } /** @@ -677,52 +715,6 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Delete - * - * Operation to delete a SenderUsernames resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param emailServiceName The name of the EmailService resource. - * @param domainName The name of the Domains resource. - * @param senderUsername The valid sender Username. - * @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 emailServiceName, - String domainName, String senderUsername, 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.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (emailServiceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); - } - if (domainName == null) { - return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); - } - if (senderUsername == null) { - return Mono.error(new IllegalArgumentException("Parameter senderUsername is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, emailServiceName, domainName, senderUsername, accept, context); - } - /** * Delete * @@ -762,8 +754,36 @@ private Mono deleteAsync(String resourceGroupName, String emailServiceName @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceGroupName, String emailServiceName, String domainName, String senderUsername, Context context) { - return deleteWithResponseAsync(resourceGroupName, emailServiceName, domainName, senderUsername, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (senderUsername == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter senderUsername is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, senderUsername, accept, + context); } /** @@ -785,6 +805,8 @@ public void delete(String resourceGroupName, String emailServiceName, String dom } /** + * ListBy_Domains + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -812,6 +834,37 @@ private Mono> listByDomainsNextSingle } /** + * ListBy_Domains + * + * 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 a class representing a Domains SenderUsernames collection along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDomainsNextSinglePage(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.listByDomainsNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * ListBy_Domains + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -819,23 +872,25 @@ private Mono> listByDomainsNextSingle * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 class representing a Domains SenderUsernames collection along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a class representing a Domains SenderUsernames collection along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDomainsNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByDomainsNextSinglePage(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.listByDomainsNext(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.listByDomainsNextSync(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(SenderUsernamesClientImpl.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernameResourceImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernameResourceImpl.java new file mode 100644 index 000000000000..a1f6a4c9ea3e --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernameResourceImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communication.fluent.models.SmtpUsernameResourceInner; +import com.azure.resourcemanager.communication.models.SmtpUsernameResource; + +public final class SmtpUsernameResourceImpl + implements SmtpUsernameResource, SmtpUsernameResource.Definition, SmtpUsernameResource.Update { + private SmtpUsernameResourceInner innerObject; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String username() { + return this.innerModel().username(); + } + + public String entraApplicationId() { + return this.innerModel().entraApplicationId(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SmtpUsernameResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communicationServiceName; + + private String smtpUsername; + + public SmtpUsernameResourceImpl withExistingCommunicationService(String resourceGroupName, + String communicationServiceName) { + this.resourceGroupName = resourceGroupName; + this.communicationServiceName = communicationServiceName; + return this; + } + + public SmtpUsernameResource create() { + this.innerObject = serviceManager.serviceClient() + .getSmtpUsernames() + .createOrUpdateWithResponse(resourceGroupName, communicationServiceName, smtpUsername, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SmtpUsernameResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSmtpUsernames() + .createOrUpdateWithResponse(resourceGroupName, communicationServiceName, smtpUsername, this.innerModel(), + context) + .getValue(); + return this; + } + + SmtpUsernameResourceImpl(String name, com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = new SmtpUsernameResourceInner(); + this.serviceManager = serviceManager; + this.smtpUsername = name; + } + + public SmtpUsernameResourceImpl update() { + return this; + } + + public SmtpUsernameResource apply() { + this.innerObject = serviceManager.serviceClient() + .getSmtpUsernames() + .createOrUpdateWithResponse(resourceGroupName, communicationServiceName, smtpUsername, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SmtpUsernameResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSmtpUsernames() + .createOrUpdateWithResponse(resourceGroupName, communicationServiceName, smtpUsername, this.innerModel(), + context) + .getValue(); + return this; + } + + SmtpUsernameResourceImpl(SmtpUsernameResourceInner innerObject, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.communicationServiceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "communicationServices"); + this.smtpUsername = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "smtpUsernames"); + } + + public SmtpUsernameResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getSmtpUsernames() + .getWithResponse(resourceGroupName, communicationServiceName, smtpUsername, Context.NONE) + .getValue(); + return this; + } + + public SmtpUsernameResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSmtpUsernames() + .getWithResponse(resourceGroupName, communicationServiceName, smtpUsername, context) + .getValue(); + return this; + } + + public SmtpUsernameResourceImpl withUsername(String username) { + this.innerModel().withUsername(username); + return this; + } + + public SmtpUsernameResourceImpl withEntraApplicationId(String entraApplicationId) { + this.innerModel().withEntraApplicationId(entraApplicationId); + return this; + } + + public SmtpUsernameResourceImpl withTenantId(String tenantId) { + this.innerModel().withTenantId(tenantId); + return this; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernamesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernamesClientImpl.java new file mode 100644 index 000000000000..3eb396bc774b --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernamesClientImpl.java @@ -0,0 +1,837 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.fluent.SmtpUsernamesClient; +import com.azure.resourcemanager.communication.fluent.models.SmtpUsernameResourceInner; +import com.azure.resourcemanager.communication.models.SmtpUsernameResourceCollection; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SmtpUsernamesClient. + */ +public final class SmtpUsernamesClientImpl implements SmtpUsernamesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SmtpUsernamesService service; + + /** + * The service client containing this operation class. + */ + private final CommunicationServiceManagementClientImpl client; + + /** + * Initializes an instance of SmtpUsernamesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SmtpUsernamesClientImpl(CommunicationServiceManagementClientImpl client) { + this.service + = RestProxy.create(SmtpUsernamesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommunicationServiceManagementClientSmtpUsernames to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CommunicationServiceManagementClientSmtpUsernames") + public interface SmtpUsernamesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/smtpUsernames") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/smtpUsernames") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/smtpUsernames/{smtpUsername}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @PathParam("smtpUsername") String smtpUsername, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/smtpUsernames/{smtpUsername}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @PathParam("smtpUsername") String smtpUsername, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/smtpUsernames/{smtpUsername}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @PathParam("smtpUsername") String smtpUsername, + @BodyParam("application/json") SmtpUsernameResourceInner parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/smtpUsernames/{smtpUsername}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @PathParam("smtpUsername") String smtpUsername, + @BodyParam("application/json") SmtpUsernameResourceInner parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/smtpUsernames/{smtpUsername}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @PathParam("smtpUsername") String smtpUsername, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/smtpUsernames/{smtpUsername}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @PathParam("smtpUsername") String smtpUsername, @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) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String communicationServiceName) { + 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 (communicationServiceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter communicationServiceName 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, communicationServiceName, 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 + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String communicationServiceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, communicationServiceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String communicationServiceName) { + 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName 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, communicationServiceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String communicationServiceName, 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName 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, communicationServiceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String communicationServiceName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, communicationServiceName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String communicationServiceName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, communicationServiceName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SmtpUsernameResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String communicationServiceName, String smtpUsername) { + 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 (communicationServiceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (smtpUsername == null) { + return Mono.error(new IllegalArgumentException("Parameter smtpUsername 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, communicationServiceName, smtpUsername, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SmtpUsernameResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String communicationServiceName, + String smtpUsername) { + return getWithResponseAsync(resourceGroupName, communicationServiceName, smtpUsername) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 SmtpUsernameResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String communicationServiceName, String smtpUsername, 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (smtpUsername == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter smtpUsername is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communicationServiceName, smtpUsername, accept, context); + } + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SmtpUsernameResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SmtpUsernameResourceInner get(String resourceGroupName, String communicationServiceName, + String smtpUsername) { + return getWithResponse(resourceGroupName, communicationServiceName, smtpUsername, Context.NONE).getValue(); + } + + /** + * Create Or Update + * + * Create or update an SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @param parameters Parameters for the create or update 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 object describing the smtp username resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String communicationServiceName, String smtpUsername, SmtpUsernameResourceInner 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 (communicationServiceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (smtpUsername == null) { + return Mono.error(new IllegalArgumentException("Parameter smtpUsername 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(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, smtpUsername, parameters, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update + * + * Create or update an SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @param parameters Parameters for the create or update 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 object describing the smtp username resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String communicationServiceName, String smtpUsername, SmtpUsernameResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, communicationServiceName, smtpUsername, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create Or Update + * + * Create or update an SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @param parameters Parameters for the create or update operation. + * @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 object describing the smtp username resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String communicationServiceName, String smtpUsername, SmtpUsernameResourceInner 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (smtpUsername == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter smtpUsername 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 accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, smtpUsername, parameters, + accept, context); + } + + /** + * Create Or Update + * + * Create or update an SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @param parameters Parameters for the create or update 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 object describing the smtp username resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SmtpUsernameResourceInner createOrUpdate(String resourceGroupName, String communicationServiceName, + String smtpUsername, SmtpUsernameResourceInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, communicationServiceName, smtpUsername, parameters, + Context.NONE).getValue(); + } + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communicationServiceName, + String smtpUsername) { + 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 (communicationServiceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (smtpUsername == null) { + return Mono.error(new IllegalArgumentException("Parameter smtpUsername 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, communicationServiceName, smtpUsername, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 communicationServiceName, String smtpUsername) { + return deleteWithResponseAsync(resourceGroupName, communicationServiceName, smtpUsername) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 communicationServiceName, + String smtpUsername, 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 (communicationServiceName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (smtpUsername == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter smtpUsername is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communicationServiceName, smtpUsername, accept, + context); + } + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 communicationServiceName, String smtpUsername) { + deleteWithResponse(resourceGroupName, communicationServiceName, smtpUsername, Context.NONE); + } + + /** + * Get + * + * 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 all SmtpUsernameResources for a Communication resource 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 + * + * 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 all SmtpUsernameResources for a Communication resource 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 + * + * 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 all SmtpUsernameResources for a Communication resource 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(SmtpUsernamesClientImpl.class); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernamesImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernamesImpl.java new file mode 100644 index 000000000000..1466c70a4613 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernamesImpl.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.SmtpUsernamesClient; +import com.azure.resourcemanager.communication.fluent.models.SmtpUsernameResourceInner; +import com.azure.resourcemanager.communication.models.SmtpUsernameResource; +import com.azure.resourcemanager.communication.models.SmtpUsernames; + +public final class SmtpUsernamesImpl implements SmtpUsernames { + private static final ClientLogger LOGGER = new ClientLogger(SmtpUsernamesImpl.class); + + private final SmtpUsernamesClient innerClient; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + public SmtpUsernamesImpl(SmtpUsernamesClient innerClient, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String communicationServiceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, communicationServiceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SmtpUsernameResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String communicationServiceName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, communicationServiceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SmtpUsernameResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String communicationServiceName, + String smtpUsername, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, communicationServiceName, smtpUsername, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SmtpUsernameResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SmtpUsernameResource get(String resourceGroupName, String communicationServiceName, String smtpUsername) { + SmtpUsernameResourceInner inner + = this.serviceClient().get(resourceGroupName, communicationServiceName, smtpUsername); + if (inner != null) { + return new SmtpUsernameResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String communicationServiceName, + String smtpUsername, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, communicationServiceName, smtpUsername, context); + } + + public void delete(String resourceGroupName, String communicationServiceName, String smtpUsername) { + this.serviceClient().delete(resourceGroupName, communicationServiceName, smtpUsername); + } + + public SmtpUsernameResource 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 communicationServiceName = ResourceManagerUtils.getValueFromIdByName(id, "communicationServices"); + if (communicationServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communicationServices'.", id))); + } + String smtpUsername = ResourceManagerUtils.getValueFromIdByName(id, "smtpUsernames"); + if (smtpUsername == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'smtpUsernames'.", id))); + } + return this.getWithResponse(resourceGroupName, communicationServiceName, smtpUsername, 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 communicationServiceName = ResourceManagerUtils.getValueFromIdByName(id, "communicationServices"); + if (communicationServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communicationServices'.", id))); + } + String smtpUsername = ResourceManagerUtils.getValueFromIdByName(id, "smtpUsernames"); + if (smtpUsername == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'smtpUsernames'.", id))); + } + return this.getWithResponse(resourceGroupName, communicationServiceName, smtpUsername, 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 communicationServiceName = ResourceManagerUtils.getValueFromIdByName(id, "communicationServices"); + if (communicationServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communicationServices'.", id))); + } + String smtpUsername = ResourceManagerUtils.getValueFromIdByName(id, "smtpUsernames"); + if (smtpUsername == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'smtpUsernames'.", id))); + } + this.deleteWithResponse(resourceGroupName, communicationServiceName, smtpUsername, 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 communicationServiceName = ResourceManagerUtils.getValueFromIdByName(id, "communicationServices"); + if (communicationServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communicationServices'.", id))); + } + String smtpUsername = ResourceManagerUtils.getValueFromIdByName(id, "smtpUsernames"); + if (smtpUsername == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'smtpUsernames'.", id))); + } + return this.deleteWithResponse(resourceGroupName, communicationServiceName, smtpUsername, context); + } + + private SmtpUsernamesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } + + public SmtpUsernameResourceImpl define(String name) { + return new SmtpUsernameResourceImpl(name, this.manager()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressResourceImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressResourceImpl.java new file mode 100644 index 000000000000..3644d08f0cb9 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressResourceImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListAddressResourceInner; +import com.azure.resourcemanager.communication.models.SuppressionListAddressResource; +import java.time.OffsetDateTime; + +public final class SuppressionListAddressResourceImpl implements SuppressionListAddressResource, + SuppressionListAddressResource.Definition, SuppressionListAddressResource.Update { + private SuppressionListAddressResourceInner innerObject; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String email() { + return this.innerModel().email(); + } + + public String firstName() { + return this.innerModel().firstName(); + } + + public String lastName() { + return this.innerModel().lastName(); + } + + public String notes() { + return this.innerModel().notes(); + } + + public OffsetDateTime lastModified() { + return this.innerModel().lastModified(); + } + + public String dataLocation() { + return this.innerModel().dataLocation(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SuppressionListAddressResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String emailServiceName; + + private String domainName; + + private String suppressionListName; + + private String addressId; + + public SuppressionListAddressResourceImpl withExistingSuppressionList(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName) { + this.resourceGroupName = resourceGroupName; + this.emailServiceName = emailServiceName; + this.domainName = domainName; + this.suppressionListName = suppressionListName; + return this; + } + + public SuppressionListAddressResource create() { + this.innerObject = serviceManager.serviceClient() + .getSuppressionListAddresses() + .createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SuppressionListAddressResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSuppressionListAddresses() + .createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + this.innerModel(), context) + .getValue(); + return this; + } + + SuppressionListAddressResourceImpl(String name, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = new SuppressionListAddressResourceInner(); + this.serviceManager = serviceManager; + this.addressId = name; + } + + public SuppressionListAddressResourceImpl update() { + return this; + } + + public SuppressionListAddressResource apply() { + this.innerObject = serviceManager.serviceClient() + .getSuppressionListAddresses() + .createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SuppressionListAddressResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSuppressionListAddresses() + .createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + this.innerModel(), context) + .getValue(); + return this; + } + + SuppressionListAddressResourceImpl(SuppressionListAddressResourceInner innerObject, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.emailServiceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "emailServices"); + this.domainName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "domains"); + this.suppressionListName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "suppressionLists"); + this.addressId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "suppressionListAddresses"); + } + + public SuppressionListAddressResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getSuppressionListAddresses() + .getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + Context.NONE) + .getValue(); + return this; + } + + public SuppressionListAddressResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSuppressionListAddresses() + .getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, context) + .getValue(); + return this; + } + + public SuppressionListAddressResourceImpl withEmail(String email) { + this.innerModel().withEmail(email); + return this; + } + + public SuppressionListAddressResourceImpl withFirstName(String firstName) { + this.innerModel().withFirstName(firstName); + return this; + } + + public SuppressionListAddressResourceImpl withLastName(String lastName) { + this.innerModel().withLastName(lastName); + return this; + } + + public SuppressionListAddressResourceImpl withNotes(String notes) { + this.innerModel().withNotes(notes); + return this; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressesClientImpl.java new file mode 100644 index 000000000000..294e13442842 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressesClientImpl.java @@ -0,0 +1,956 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.fluent.SuppressionListAddressesClient; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListAddressResourceInner; +import com.azure.resourcemanager.communication.models.SuppressionListAddressResourceCollection; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SuppressionListAddressesClient. + */ +public final class SuppressionListAddressesClientImpl implements SuppressionListAddressesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SuppressionListAddressesService service; + + /** + * The service client containing this operation class. + */ + private final CommunicationServiceManagementClientImpl client; + + /** + * Initializes an instance of SuppressionListAddressesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SuppressionListAddressesClientImpl(CommunicationServiceManagementClientImpl client) { + this.service = RestProxy.create(SuppressionListAddressesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommunicationServiceManagementClientSuppressionListAddresses to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CommunicationServiceManagementClientSuppressionListAddresses") + public interface SuppressionListAddressesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @PathParam("addressId") String addressId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @PathParam("addressId") String addressId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @PathParam("addressId") String addressId, + @BodyParam("application/json") SuppressionListAddressResourceInner parameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @PathParam("addressId") String addressId, + @BodyParam("application/json") SuppressionListAddressResourceInner parameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @PathParam("addressId") String addressId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @PathParam("addressId") String addressId, + @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) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the addresses in a suppression list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName) { + 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 (emailServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName 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, emailServiceName, domainName, suppressionListName, + 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 + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the addresses in a suppression list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, emailServiceName, domainName, suppressionListName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the addresses in a suppression list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName) { + 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter suppressionListName 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, emailServiceName, domainName, suppressionListName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 all the addresses in a suppression list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter suppressionListName 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, emailServiceName, domainName, suppressionListName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the addresses in a suppression list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName) { + return new PagedIterable<>( + () -> listSinglePage(resourceGroupName, emailServiceName, domainName, suppressionListName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 all the addresses in a suppression list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, Context context) { + return new PagedIterable<>( + () -> listSinglePage(resourceGroupName, emailServiceName, domainName, suppressionListName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SuppressionListAddress along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, String addressId) { + 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 (emailServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName is required and cannot be null.")); + } + if (addressId == null) { + return Mono.error(new IllegalArgumentException("Parameter addressId 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, emailServiceName, domainName, suppressionListName, + addressId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SuppressionListAddress on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, String addressId) { + return getWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 SuppressionListAddress along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, String addressId, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter suppressionListName is required and cannot be null.")); + } + if (addressId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter addressId is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, accept, context); + } + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SuppressionListAddress. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SuppressionListAddressResourceInner get(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName, String addressId) { + return getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + Context.NONE).getValue(); + } + + /** + * Create Or Update + * + * Create or update a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @param parameters Parameters for the create or update 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 object that represents a SuppressionList record along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String emailServiceName, String domainName, String suppressionListName, + String addressId, SuppressionListAddressResourceInner 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 (emailServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName is required and cannot be null.")); + } + if (addressId == null) { + return Mono.error(new IllegalArgumentException("Parameter addressId 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(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, suppressionListName, + addressId, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update + * + * Create or update a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @param parameters Parameters for the create or update 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 object that represents a SuppressionList record on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, String addressId, + SuppressionListAddressResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, + addressId, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create Or Update + * + * Create or update a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @param parameters Parameters for the create or update operation. + * @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 object that represents a SuppressionList record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, String addressId, + SuppressionListAddressResourceInner 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter suppressionListName is required and cannot be null.")); + } + if (addressId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter addressId 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 accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, suppressionListName, + addressId, parameters, accept, context); + } + + /** + * Create Or Update + * + * Create or update a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @param parameters Parameters for the create or update 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 object that represents a SuppressionList record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SuppressionListAddressResourceInner createOrUpdate(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, String addressId, + SuppressionListAddressResourceInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, + addressId, parameters, Context.NONE).getValue(); + } + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 emailServiceName, + String domainName, String suppressionListName, String addressId) { + 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 (emailServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName is required and cannot be null.")); + } + if (addressId == null) { + return Mono.error(new IllegalArgumentException("Parameter addressId 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, emailServiceName, domainName, suppressionListName, + addressId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 emailServiceName, String domainName, + String suppressionListName, String addressId) { + return deleteWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 emailServiceName, String domainName, + String suppressionListName, String addressId, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter suppressionListName is required and cannot be null.")); + } + if (addressId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter addressId is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, suppressionListName, + addressId, accept, context); + } + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 emailServiceName, String domainName, String suppressionListName, + String addressId) { + deleteWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + Context.NONE); + } + + /** + * Get + * + * 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 all the addresses in a suppression list 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 + * + * 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 all the addresses in a suppression list 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 + * + * 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 all the addresses in a suppression list 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(SuppressionListAddressesClientImpl.class); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressesImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressesImpl.java new file mode 100644 index 000000000000..d52522f9604f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressesImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.SuppressionListAddressesClient; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListAddressResourceInner; +import com.azure.resourcemanager.communication.models.SuppressionListAddressResource; +import com.azure.resourcemanager.communication.models.SuppressionListAddresses; + +public final class SuppressionListAddressesImpl implements SuppressionListAddresses { + private static final ClientLogger LOGGER = new ClientLogger(SuppressionListAddressesImpl.class); + + private final SuppressionListAddressesClient innerClient; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + public SuppressionListAddressesImpl(SuppressionListAddressesClient innerClient, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, emailServiceName, domainName, suppressionListName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SuppressionListAddressResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, emailServiceName, domainName, suppressionListName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SuppressionListAddressResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, String addressId, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SuppressionListAddressResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SuppressionListAddressResource get(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName, String addressId) { + SuppressionListAddressResourceInner inner + = this.serviceClient().get(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId); + if (inner != null) { + return new SuppressionListAddressResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName, String addressId, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + context); + } + + public void delete(String resourceGroupName, String emailServiceName, String domainName, String suppressionListName, + String addressId) { + this.serviceClient().delete(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId); + } + + public SuppressionListAddressResource 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 emailServiceName = ResourceManagerUtils.getValueFromIdByName(id, "emailServices"); + if (emailServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'emailServices'.", id))); + } + String domainName = ResourceManagerUtils.getValueFromIdByName(id, "domains"); + if (domainName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'domains'.", id))); + } + String suppressionListName = ResourceManagerUtils.getValueFromIdByName(id, "suppressionLists"); + if (suppressionListName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'suppressionLists'.", id))); + } + String addressId = ResourceManagerUtils.getValueFromIdByName(id, "suppressionListAddresses"); + if (addressId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'suppressionListAddresses'.", id))); + } + return this + .getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + 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 emailServiceName = ResourceManagerUtils.getValueFromIdByName(id, "emailServices"); + if (emailServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'emailServices'.", id))); + } + String domainName = ResourceManagerUtils.getValueFromIdByName(id, "domains"); + if (domainName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'domains'.", id))); + } + String suppressionListName = ResourceManagerUtils.getValueFromIdByName(id, "suppressionLists"); + if (suppressionListName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'suppressionLists'.", id))); + } + String addressId = ResourceManagerUtils.getValueFromIdByName(id, "suppressionListAddresses"); + if (addressId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'suppressionListAddresses'.", id))); + } + return this.getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + 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 emailServiceName = ResourceManagerUtils.getValueFromIdByName(id, "emailServices"); + if (emailServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'emailServices'.", id))); + } + String domainName = ResourceManagerUtils.getValueFromIdByName(id, "domains"); + if (domainName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'domains'.", id))); + } + String suppressionListName = ResourceManagerUtils.getValueFromIdByName(id, "suppressionLists"); + if (suppressionListName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'suppressionLists'.", id))); + } + String addressId = ResourceManagerUtils.getValueFromIdByName(id, "suppressionListAddresses"); + if (addressId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'suppressionListAddresses'.", id))); + } + this.deleteWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + 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 emailServiceName = ResourceManagerUtils.getValueFromIdByName(id, "emailServices"); + if (emailServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'emailServices'.", id))); + } + String domainName = ResourceManagerUtils.getValueFromIdByName(id, "domains"); + if (domainName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'domains'.", id))); + } + String suppressionListName = ResourceManagerUtils.getValueFromIdByName(id, "suppressionLists"); + if (suppressionListName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'suppressionLists'.", id))); + } + String addressId = ResourceManagerUtils.getValueFromIdByName(id, "suppressionListAddresses"); + if (addressId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'suppressionListAddresses'.", id))); + } + return this.deleteWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + context); + } + + private SuppressionListAddressesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } + + public SuppressionListAddressResourceImpl define(String name) { + return new SuppressionListAddressResourceImpl(name, this.manager()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListResourceImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListResourceImpl.java new file mode 100644 index 000000000000..1cd13e5b1964 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListResourceImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListResourceInner; +import com.azure.resourcemanager.communication.models.SuppressionListResource; + +public final class SuppressionListResourceImpl + implements SuppressionListResource, SuppressionListResource.Definition, SuppressionListResource.Update { + private SuppressionListResourceInner innerObject; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String listName() { + return this.innerModel().listName(); + } + + public String lastUpdatedTimestamp() { + return this.innerModel().lastUpdatedTimestamp(); + } + + public String createdTimestamp() { + return this.innerModel().createdTimestamp(); + } + + public String dataLocation() { + return this.innerModel().dataLocation(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SuppressionListResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String emailServiceName; + + private String domainName; + + private String suppressionListName; + + public SuppressionListResourceImpl withExistingDomain(String resourceGroupName, String emailServiceName, + String domainName) { + this.resourceGroupName = resourceGroupName; + this.emailServiceName = emailServiceName; + this.domainName = domainName; + return this; + } + + public SuppressionListResource create() { + this.innerObject = serviceManager.serviceClient() + .getSuppressionLists() + .createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SuppressionListResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSuppressionLists() + .createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, + this.innerModel(), context) + .getValue(); + return this; + } + + SuppressionListResourceImpl(String name, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = new SuppressionListResourceInner(); + this.serviceManager = serviceManager; + this.suppressionListName = name; + } + + public SuppressionListResourceImpl update() { + return this; + } + + public SuppressionListResource apply() { + this.innerObject = serviceManager.serviceClient() + .getSuppressionLists() + .createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SuppressionListResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSuppressionLists() + .createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, + this.innerModel(), context) + .getValue(); + return this; + } + + SuppressionListResourceImpl(SuppressionListResourceInner innerObject, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.emailServiceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "emailServices"); + this.domainName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "domains"); + this.suppressionListName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "suppressionLists"); + } + + public SuppressionListResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getSuppressionLists() + .getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, Context.NONE) + .getValue(); + return this; + } + + public SuppressionListResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSuppressionLists() + .getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, context) + .getValue(); + return this; + } + + public SuppressionListResourceImpl withListName(String listName) { + this.innerModel().withListName(listName); + return this; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListsClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListsClientImpl.java new file mode 100644 index 000000000000..7fb240b54926 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListsClientImpl.java @@ -0,0 +1,905 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.fluent.SuppressionListsClient; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListResourceInner; +import com.azure.resourcemanager.communication.models.SuppressionListResourceCollection; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SuppressionListsClient. + */ +public final class SuppressionListsClientImpl implements SuppressionListsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SuppressionListsService service; + + /** + * The service client containing this operation class. + */ + private final CommunicationServiceManagementClientImpl client; + + /** + * Initializes an instance of SuppressionListsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SuppressionListsClientImpl(CommunicationServiceManagementClientImpl client) { + this.service + = RestProxy.create(SuppressionListsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommunicationServiceManagementClientSuppressionLists to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CommunicationServiceManagementClientSuppressionLists") + public interface SuppressionListsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDomain(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByDomainSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, + @BodyParam("application/json") SuppressionListResourceInner parameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, + @BodyParam("application/json") SuppressionListResourceInner parameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("emailServiceName") String emailServiceName, @PathParam("domainName") String domainName, + @PathParam("suppressionListName") String suppressionListName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDomainNext( + @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) + Response listByDomainNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDomainSinglePageAsync(String resourceGroupName, + String emailServiceName, String domainName) { + 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 (emailServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDomain(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, 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())); + } + + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDomainAsync(String resourceGroupName, String emailServiceName, + String domainName) { + return new PagedFlux<>(() -> listByDomainSinglePageAsync(resourceGroupName, emailServiceName, domainName), + nextLink -> listByDomainNextSinglePageAsync(nextLink)); + } + + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDomainSinglePage(String resourceGroupName, + String emailServiceName, String domainName) { + 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDomainSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDomainSinglePage(String resourceGroupName, + String emailServiceName, String domainName, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDomainSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDomain(String resourceGroupName, String emailServiceName, + String domainName) { + return new PagedIterable<>(() -> listByDomainSinglePage(resourceGroupName, emailServiceName, domainName), + nextLink -> listByDomainNextSinglePage(nextLink)); + } + + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDomain(String resourceGroupName, String emailServiceName, + String domainName, Context context) { + return new PagedIterable<>( + () -> listByDomainSinglePage(resourceGroupName, emailServiceName, domainName, context), + nextLink -> listByDomainNextSinglePage(nextLink, context)); + } + + /** + * Get + * + * Get a SuppressionList resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SuppressionList resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName) { + 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 (emailServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName 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, emailServiceName, domainName, suppressionListName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get + * + * Get a SuppressionList resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SuppressionList resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName) { + return getWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get + * + * Get a SuppressionList resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 SuppressionList resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter suppressionListName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, emailServiceName, domainName, suppressionListName, accept, context); + } + + /** + * Get + * + * Get a SuppressionList resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SuppressionList resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SuppressionListResourceInner get(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName) { + return getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, Context.NONE) + .getValue(); + } + + /** + * Create Or Update + * + * Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList + * resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param parameters Parameters for the create or update 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 class representing a SuppressionList resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, + SuppressionListResourceInner 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 (emailServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName 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(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, suppressionListName, + parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update + * + * Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList + * resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param parameters Parameters for the create or update 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 class representing a SuppressionList resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, SuppressionListResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, + parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create Or Update + * + * Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList + * resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param parameters Parameters for the create or update operation. + * @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 class representing a SuppressionList resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, SuppressionListResourceInner 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter suppressionListName 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 accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, suppressionListName, + parameters, accept, context); + } + + /** + * Create Or Update + * + * Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList + * resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param parameters Parameters for the create or update 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 class representing a SuppressionList resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SuppressionListResourceInner createOrUpdate(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, SuppressionListResourceInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, + parameters, Context.NONE).getValue(); + } + + /** + * Delete + * + * Delete a SuppressionList. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 emailServiceName, + String domainName, String suppressionListName) { + 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 (emailServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + return Mono.error(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName 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, emailServiceName, domainName, suppressionListName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete + * + * Delete a SuppressionList. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 emailServiceName, String domainName, + String suppressionListName) { + return deleteWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete + * + * Delete a SuppressionList. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 emailServiceName, String domainName, + String suppressionListName, 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 (emailServiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter emailServiceName is required and cannot be null.")); + } + if (domainName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter domainName is required and cannot be null.")); + } + if (suppressionListName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter suppressionListName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, emailServiceName, domainName, suppressionListName, + accept, context); + } + + /** + * Delete + * + * Delete a SuppressionList. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 emailServiceName, String domainName, + String suppressionListName) { + deleteWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, Context.NONE); + } + + /** + * List + * + * 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 a class representing a Domains SuppressionListResource collection along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDomainNextSinglePageAsync(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.listByDomainNext(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())); + } + + /** + * List + * + * 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 a class representing a Domains SuppressionListResource collection along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDomainNextSinglePage(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.listByDomainNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List + * + * 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 a class representing a Domains SuppressionListResource collection along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDomainNextSinglePage(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.listByDomainNextSync(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(SuppressionListsClientImpl.class); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListsImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListsImpl.java new file mode 100644 index 000000000000..3598a0ecb934 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListsImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.SuppressionListsClient; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListResourceInner; +import com.azure.resourcemanager.communication.models.SuppressionListResource; +import com.azure.resourcemanager.communication.models.SuppressionLists; + +public final class SuppressionListsImpl implements SuppressionLists { + private static final ClientLogger LOGGER = new ClientLogger(SuppressionListsImpl.class); + + private final SuppressionListsClient innerClient; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + public SuppressionListsImpl(SuppressionListsClient innerClient, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDomain(String resourceGroupName, String emailServiceName, + String domainName) { + PagedIterable inner + = this.serviceClient().listByDomain(resourceGroupName, emailServiceName, domainName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SuppressionListResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByDomain(String resourceGroupName, String emailServiceName, + String domainName, Context context) { + PagedIterable inner + = this.serviceClient().listByDomain(resourceGroupName, emailServiceName, domainName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SuppressionListResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SuppressionListResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SuppressionListResource get(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName) { + SuppressionListResourceInner inner + = this.serviceClient().get(resourceGroupName, emailServiceName, domainName, suppressionListName); + if (inner != null) { + return new SuppressionListResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, context); + } + + public void delete(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName) { + this.serviceClient().delete(resourceGroupName, emailServiceName, domainName, suppressionListName); + } + + public SuppressionListResource 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 emailServiceName = ResourceManagerUtils.getValueFromIdByName(id, "emailServices"); + if (emailServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'emailServices'.", id))); + } + String domainName = ResourceManagerUtils.getValueFromIdByName(id, "domains"); + if (domainName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'domains'.", id))); + } + String suppressionListName = ResourceManagerUtils.getValueFromIdByName(id, "suppressionLists"); + if (suppressionListName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'suppressionLists'.", id))); + } + return this.getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, 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 emailServiceName = ResourceManagerUtils.getValueFromIdByName(id, "emailServices"); + if (emailServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'emailServices'.", id))); + } + String domainName = ResourceManagerUtils.getValueFromIdByName(id, "domains"); + if (domainName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'domains'.", id))); + } + String suppressionListName = ResourceManagerUtils.getValueFromIdByName(id, "suppressionLists"); + if (suppressionListName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'suppressionLists'.", id))); + } + return this.getWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, 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 emailServiceName = ResourceManagerUtils.getValueFromIdByName(id, "emailServices"); + if (emailServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'emailServices'.", id))); + } + String domainName = ResourceManagerUtils.getValueFromIdByName(id, "domains"); + if (domainName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'domains'.", id))); + } + String suppressionListName = ResourceManagerUtils.getValueFromIdByName(id, "suppressionLists"); + if (suppressionListName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'suppressionLists'.", id))); + } + this.deleteWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, 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 emailServiceName = ResourceManagerUtils.getValueFromIdByName(id, "emailServices"); + if (emailServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'emailServices'.", id))); + } + String domainName = ResourceManagerUtils.getValueFromIdByName(id, "domains"); + if (domainName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'domains'.", id))); + } + String suppressionListName = ResourceManagerUtils.getValueFromIdByName(id, "suppressionLists"); + if (suppressionListName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'suppressionLists'.", id))); + } + return this.deleteWithResponse(resourceGroupName, emailServiceName, domainName, suppressionListName, context); + } + + private SuppressionListsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } + + public SuppressionListResourceImpl define(String name) { + return new SuppressionListResourceImpl(name, this.manager()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java index fa21015c6c28..19db36bc6ee8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java @@ -115,6 +115,22 @@ public interface CommunicationServiceResource { */ List linkedDomains(); + /** + * Gets the publicNetworkAccess property: Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be 'Enabled', + * 'Disabled' or 'SecuredByPerimeter'. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccess publicNetworkAccess(); + + /** + * Gets the disableLocalAuth property: Disable local authentication for the CommunicationService. + * + * @return the disableLocalAuth value. + */ + Boolean disableLocalAuth(); + /** * Gets the region of the resource. * @@ -199,7 +215,8 @@ interface WithResourceGroup { * for the resource to be created, but also allows for any other optional properties to be specified. */ interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, - DefinitionStages.WithDataLocation, DefinitionStages.WithLinkedDomains { + DefinitionStages.WithDataLocation, DefinitionStages.WithLinkedDomains, + DefinitionStages.WithPublicNetworkAccess, DefinitionStages.WithDisableLocalAuth { /** * Executes the create request. * @@ -269,6 +286,36 @@ interface WithLinkedDomains { */ WithCreate withLinkedDomains(List linkedDomains); } + + /** + * The stage of the CommunicationServiceResource definition allowing to specify publicNetworkAccess. + */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Allow, disallow, or let network security perimeter + * configuration control public network access to the protected resource. Value is optional but if passed + * in, it must be 'Enabled', 'Disabled' or 'SecuredByPerimeter'.. + * + * @param publicNetworkAccess Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be + * 'Enabled', 'Disabled' or 'SecuredByPerimeter'. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + + /** + * The stage of the CommunicationServiceResource definition allowing to specify disableLocalAuth. + */ + interface WithDisableLocalAuth { + /** + * Specifies the disableLocalAuth property: Disable local authentication for the CommunicationService.. + * + * @param disableLocalAuth Disable local authentication for the CommunicationService. + * @return the next definition stage. + */ + WithCreate withDisableLocalAuth(Boolean disableLocalAuth); + } } /** @@ -281,7 +328,8 @@ interface WithLinkedDomains { /** * The template for CommunicationServiceResource update. */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithLinkedDomains { + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithLinkedDomains, + UpdateStages.WithPublicNetworkAccess, UpdateStages.WithDisableLocalAuth { /** * Executes the update request. * @@ -342,6 +390,36 @@ interface WithLinkedDomains { */ Update withLinkedDomains(List linkedDomains); } + + /** + * The stage of the CommunicationServiceResource update allowing to specify publicNetworkAccess. + */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Allow, disallow, or let network security perimeter + * configuration control public network access to the protected resource. Value is optional but if passed + * in, it must be 'Enabled', 'Disabled' or 'SecuredByPerimeter'.. + * + * @param publicNetworkAccess Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be + * 'Enabled', 'Disabled' or 'SecuredByPerimeter'. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + + /** + * The stage of the CommunicationServiceResource update allowing to specify disableLocalAuth. + */ + interface WithDisableLocalAuth { + /** + * Specifies the disableLocalAuth property: Disable local authentication for the CommunicationService.. + * + * @param disableLocalAuth Disable local authentication for the CommunicationService. + * @return the next definition stage. + */ + Update withDisableLocalAuth(Boolean disableLocalAuth); + } } /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java index 09e480267ef7..463b9f4ef66a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java @@ -95,6 +95,56 @@ public CommunicationServiceResourceUpdate withLinkedDomains(List linkedD return this; } + /** + * Get the publicNetworkAccess property: Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be 'Enabled', + * 'Disabled' or 'SecuredByPerimeter'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Allow, disallow, or let network security perimeter configuration control + * public network access to the protected resource. Value is optional but if passed in, it must be 'Enabled', + * 'Disabled' or 'SecuredByPerimeter'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the CommunicationServiceResourceUpdate object itself. + */ + public CommunicationServiceResourceUpdate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationServiceUpdateProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the disableLocalAuth property: Disable local authentication for the CommunicationService. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.innerProperties() == null ? null : this.innerProperties().disableLocalAuth(); + } + + /** + * Set the disableLocalAuth property: Disable local authentication for the CommunicationService. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the CommunicationServiceResourceUpdate object itself. + */ + public CommunicationServiceResourceUpdate withDisableLocalAuth(Boolean disableLocalAuth) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationServiceUpdateProperties(); + } + this.innerProperties().withDisableLocalAuth(disableLocalAuth); + return this; + } + /** * Validates the instance. * diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/PublicNetworkAccess.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/PublicNetworkAccess.java new file mode 100644 index 000000000000..dc7fecd2c284 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/PublicNetworkAccess.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Allow, disallow, or let network security perimeter configuration control public network access to the protected + * resource. Value is optional but if passed in, it must be 'Enabled', 'Disabled' or 'SecuredByPerimeter'. + */ +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"); + + /** + * Static value SecuredByPerimeter for PublicNetworkAccess. + */ + public static final PublicNetworkAccess SECURED_BY_PERIMETER = fromString("SecuredByPerimeter"); + + /** + * 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/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResource.java new file mode 100644 index 000000000000..b439e6890d91 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResource.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communication.fluent.models.SmtpUsernameResourceInner; + +/** + * An immutable client-side representation of SmtpUsernameResource. + */ +public interface SmtpUsernameResource { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the username property: The SMTP username. Could be free form or in the email address format. + * + * @return the username value. + */ + String username(); + + /** + * Gets the entraApplicationId property: The application Id for the linked Entra Application. + * + * @return the entraApplicationId value. + */ + String entraApplicationId(); + + /** + * Gets the tenantId property: The tenant of the linked Entra Application. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.communication.fluent.models.SmtpUsernameResourceInner object. + * + * @return the inner object. + */ + SmtpUsernameResourceInner innerModel(); + + /** + * The entirety of the SmtpUsernameResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The SmtpUsernameResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SmtpUsernameResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SmtpUsernameResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, communicationServiceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @return the next definition stage. + */ + WithCreate withExistingCommunicationService(String resourceGroupName, String communicationServiceName); + } + + /** + * The stage of the SmtpUsernameResource 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.WithUsername, DefinitionStages.WithEntraApplicationId, + DefinitionStages.WithTenantId { + /** + * Executes the create request. + * + * @return the created resource. + */ + SmtpUsernameResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SmtpUsernameResource create(Context context); + } + + /** + * The stage of the SmtpUsernameResource definition allowing to specify username. + */ + interface WithUsername { + /** + * Specifies the username property: The SMTP username. Could be free form or in the email address format.. + * + * @param username The SMTP username. Could be free form or in the email address format. + * @return the next definition stage. + */ + WithCreate withUsername(String username); + } + + /** + * The stage of the SmtpUsernameResource definition allowing to specify entraApplicationId. + */ + interface WithEntraApplicationId { + /** + * Specifies the entraApplicationId property: The application Id for the linked Entra Application.. + * + * @param entraApplicationId The application Id for the linked Entra Application. + * @return the next definition stage. + */ + WithCreate withEntraApplicationId(String entraApplicationId); + } + + /** + * The stage of the SmtpUsernameResource definition allowing to specify tenantId. + */ + interface WithTenantId { + /** + * Specifies the tenantId property: The tenant of the linked Entra Application.. + * + * @param tenantId The tenant of the linked Entra Application. + * @return the next definition stage. + */ + WithCreate withTenantId(String tenantId); + } + } + + /** + * Begins update for the SmtpUsernameResource resource. + * + * @return the stage of resource update. + */ + SmtpUsernameResource.Update update(); + + /** + * The template for SmtpUsernameResource update. + */ + interface Update extends UpdateStages.WithUsername, UpdateStages.WithEntraApplicationId, UpdateStages.WithTenantId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SmtpUsernameResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SmtpUsernameResource apply(Context context); + } + + /** + * The SmtpUsernameResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SmtpUsernameResource update allowing to specify username. + */ + interface WithUsername { + /** + * Specifies the username property: The SMTP username. Could be free form or in the email address format.. + * + * @param username The SMTP username. Could be free form or in the email address format. + * @return the next definition stage. + */ + Update withUsername(String username); + } + + /** + * The stage of the SmtpUsernameResource update allowing to specify entraApplicationId. + */ + interface WithEntraApplicationId { + /** + * Specifies the entraApplicationId property: The application Id for the linked Entra Application.. + * + * @param entraApplicationId The application Id for the linked Entra Application. + * @return the next definition stage. + */ + Update withEntraApplicationId(String entraApplicationId); + } + + /** + * The stage of the SmtpUsernameResource update allowing to specify tenantId. + */ + interface WithTenantId { + /** + * Specifies the tenantId property: The tenant of the linked Entra Application.. + * + * @param tenantId The tenant of the linked Entra Application. + * @return the next definition stage. + */ + Update withTenantId(String tenantId); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SmtpUsernameResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SmtpUsernameResource refresh(Context context); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResourceCollection.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResourceCollection.java new file mode 100644 index 000000000000..d6da1155da53 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResourceCollection.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.models.SmtpUsernameResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * Collection of SmtpUsername resources. Response will include a nextLink if response contains more pages. + */ +@Fluent +public final class SmtpUsernameResourceCollection implements JsonSerializable { + /* + * List of SmtpUsername resources. + */ + private List value; + + /* + * The URL the client should use to fetch the next page (per server side paging). + */ + private String nextLink; + + /** + * Creates an instance of SmtpUsernameResourceCollection class. + */ + public SmtpUsernameResourceCollection() { + } + + /** + * Get the value property: List of SmtpUsername resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of SmtpUsername resources. + * + * @param value the value value to set. + * @return the SmtpUsernameResourceCollection object itself. + */ + public SmtpUsernameResourceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL the client should use to fetch the next page (per server side paging). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL the client should use to fetch the next page (per server side paging). + * + * @param nextLink the nextLink value to set. + * @return the SmtpUsernameResourceCollection object itself. + */ + public SmtpUsernameResourceCollection withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * 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.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SmtpUsernameResourceCollection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SmtpUsernameResourceCollection 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 SmtpUsernameResourceCollection. + */ + public static SmtpUsernameResourceCollection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SmtpUsernameResourceCollection deserializedSmtpUsernameResourceCollection + = new SmtpUsernameResourceCollection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SmtpUsernameResourceInner.fromJson(reader1)); + deserializedSmtpUsernameResourceCollection.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSmtpUsernameResourceCollection.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSmtpUsernameResourceCollection; + }); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernames.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernames.java new file mode 100644 index 000000000000..13471779d241 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernames.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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 SmtpUsernames. + */ +public interface SmtpUsernames { + /** + * Get + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String communicationServiceName); + + /** + * Get + * + * Get all SmtpUsernameResources for a Communication resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 all SmtpUsernameResources for a Communication resource as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String communicationServiceName, + Context context); + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 SmtpUsernameResource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String communicationServiceName, + String smtpUsername, Context context); + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 SmtpUsernameResource. + */ + SmtpUsernameResource get(String resourceGroupName, String communicationServiceName, String smtpUsername); + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 communicationServiceName, String smtpUsername, + Context context); + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param smtpUsername The name of the SmtpUsernameResource. + * @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 communicationServiceName, String smtpUsername); + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @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 a SmtpUsernameResource along with {@link Response}. + */ + SmtpUsernameResource getById(String id); + + /** + * Get + * + * Get a SmtpUsernameResource. + * + * @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 a SmtpUsernameResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @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); + + /** + * Delete + * + * Operation to delete a single SmtpUsername resource. + * + * @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 SmtpUsernameResource resource. + * + * @param name resource name. + * @return the first stage of the new SmtpUsernameResource definition. + */ + SmtpUsernameResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddressResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddressResource.java new file mode 100644 index 000000000000..bcd43c596fdc --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddressResource.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListAddressResourceInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of SuppressionListAddressResource. + */ +public interface SuppressionListAddressResource { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the email property: Email address of the recipient. + * + * @return the email value. + */ + String email(); + + /** + * Gets the firstName property: The first name of the email recipient. + * + * @return the firstName value. + */ + String firstName(); + + /** + * Gets the lastName property: The last name of the email recipient. + * + * @return the lastName value. + */ + String lastName(); + + /** + * Gets the notes property: An optional property to provide contextual notes or a description for an address. + * + * @return the notes value. + */ + String notes(); + + /** + * Gets the lastModified property: The date the address was last updated in a suppression list. + * + * @return the lastModified value. + */ + OffsetDateTime lastModified(); + + /** + * Gets the dataLocation property: The location where the SuppressionListAddress data is stored at rest. This value + * is inherited from the parent Domains resource. + * + * @return the dataLocation value. + */ + String dataLocation(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.communication.fluent.models.SuppressionListAddressResourceInner object. + * + * @return the inner object. + */ + SuppressionListAddressResourceInner innerModel(); + + /** + * The entirety of the SuppressionListAddressResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The SuppressionListAddressResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SuppressionListAddressResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SuppressionListAddressResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, emailServiceName, domainName, suppressionListName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @return the next definition stage. + */ + WithCreate withExistingSuppressionList(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName); + } + + /** + * The stage of the SuppressionListAddressResource 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.WithEmail, DefinitionStages.WithFirstName, + DefinitionStages.WithLastName, DefinitionStages.WithNotes { + /** + * Executes the create request. + * + * @return the created resource. + */ + SuppressionListAddressResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SuppressionListAddressResource create(Context context); + } + + /** + * The stage of the SuppressionListAddressResource definition allowing to specify email. + */ + interface WithEmail { + /** + * Specifies the email property: Email address of the recipient.. + * + * @param email Email address of the recipient. + * @return the next definition stage. + */ + WithCreate withEmail(String email); + } + + /** + * The stage of the SuppressionListAddressResource definition allowing to specify firstName. + */ + interface WithFirstName { + /** + * Specifies the firstName property: The first name of the email recipient.. + * + * @param firstName The first name of the email recipient. + * @return the next definition stage. + */ + WithCreate withFirstName(String firstName); + } + + /** + * The stage of the SuppressionListAddressResource definition allowing to specify lastName. + */ + interface WithLastName { + /** + * Specifies the lastName property: The last name of the email recipient.. + * + * @param lastName The last name of the email recipient. + * @return the next definition stage. + */ + WithCreate withLastName(String lastName); + } + + /** + * The stage of the SuppressionListAddressResource definition allowing to specify notes. + */ + interface WithNotes { + /** + * Specifies the notes property: An optional property to provide contextual notes or a description for an + * address.. + * + * @param notes An optional property to provide contextual notes or a description for an address. + * @return the next definition stage. + */ + WithCreate withNotes(String notes); + } + } + + /** + * Begins update for the SuppressionListAddressResource resource. + * + * @return the stage of resource update. + */ + SuppressionListAddressResource.Update update(); + + /** + * The template for SuppressionListAddressResource update. + */ + interface Update + extends UpdateStages.WithEmail, UpdateStages.WithFirstName, UpdateStages.WithLastName, UpdateStages.WithNotes { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SuppressionListAddressResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SuppressionListAddressResource apply(Context context); + } + + /** + * The SuppressionListAddressResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SuppressionListAddressResource update allowing to specify email. + */ + interface WithEmail { + /** + * Specifies the email property: Email address of the recipient.. + * + * @param email Email address of the recipient. + * @return the next definition stage. + */ + Update withEmail(String email); + } + + /** + * The stage of the SuppressionListAddressResource update allowing to specify firstName. + */ + interface WithFirstName { + /** + * Specifies the firstName property: The first name of the email recipient.. + * + * @param firstName The first name of the email recipient. + * @return the next definition stage. + */ + Update withFirstName(String firstName); + } + + /** + * The stage of the SuppressionListAddressResource update allowing to specify lastName. + */ + interface WithLastName { + /** + * Specifies the lastName property: The last name of the email recipient.. + * + * @param lastName The last name of the email recipient. + * @return the next definition stage. + */ + Update withLastName(String lastName); + } + + /** + * The stage of the SuppressionListAddressResource update allowing to specify notes. + */ + interface WithNotes { + /** + * Specifies the notes property: An optional property to provide contextual notes or a description for an + * address.. + * + * @param notes An optional property to provide contextual notes or a description for an address. + * @return the next definition stage. + */ + Update withNotes(String notes); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SuppressionListAddressResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SuppressionListAddressResource refresh(Context context); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddressResourceCollection.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddressResourceCollection.java new file mode 100644 index 000000000000..ff9d096ddf84 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddressResourceCollection.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.models.SuppressionListAddressResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * Collection of addresses in a suppression list. Response will include a nextLink if response contains more pages. + */ +@Fluent +public final class SuppressionListAddressResourceCollection + implements JsonSerializable { + /* + * List of suppressed email addresses. + */ + private List value; + + /* + * The URL the client should use to fetch the next page (per server side paging). + */ + private String nextLink; + + /** + * Creates an instance of SuppressionListAddressResourceCollection class. + */ + public SuppressionListAddressResourceCollection() { + } + + /** + * Get the value property: List of suppressed email addresses. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of suppressed email addresses. + * + * @param value the value value to set. + * @return the SuppressionListAddressResourceCollection object itself. + */ + public SuppressionListAddressResourceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL the client should use to fetch the next page (per server side paging). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL the client should use to fetch the next page (per server side paging). + * + * @param nextLink the nextLink value to set. + * @return the SuppressionListAddressResourceCollection object itself. + */ + public SuppressionListAddressResourceCollection withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * 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.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuppressionListAddressResourceCollection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuppressionListAddressResourceCollection 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 SuppressionListAddressResourceCollection. + */ + public static SuppressionListAddressResourceCollection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SuppressionListAddressResourceCollection deserializedSuppressionListAddressResourceCollection + = new SuppressionListAddressResourceCollection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SuppressionListAddressResourceInner.fromJson(reader1)); + deserializedSuppressionListAddressResourceCollection.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSuppressionListAddressResourceCollection.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSuppressionListAddressResourceCollection; + }); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddresses.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddresses.java new file mode 100644 index 000000000000..141fa327d1f0 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddresses.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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 SuppressionListAddresses. + */ +public interface SuppressionListAddresses { + /** + * Get + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 all the addresses in a suppression list as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName); + + /** + * Get + * + * Get all the addresses in a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 all the addresses in a suppression list as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, Context context); + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 SuppressionListAddress along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, String addressId, Context context); + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 SuppressionListAddress. + */ + SuppressionListAddressResource get(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName, String addressId); + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 emailServiceName, String domainName, + String suppressionListName, String addressId, Context context); + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @param addressId The id of the address in a suppression list. + * @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 emailServiceName, String domainName, String suppressionListName, + String addressId); + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @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 a SuppressionListAddress along with {@link Response}. + */ + SuppressionListAddressResource getById(String id); + + /** + * Get + * + * Get a SuppressionListAddress. + * + * @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 a SuppressionListAddress along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @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); + + /** + * Delete + * + * Operation to delete a single address from a suppression list. + * + * @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 SuppressionListAddressResource resource. + * + * @param name resource name. + * @return the first stage of the new SuppressionListAddressResource definition. + */ + SuppressionListAddressResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListResource.java new file mode 100644 index 000000000000..bbf83811b006 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListResource.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListResourceInner; + +/** + * An immutable client-side representation of SuppressionListResource. + */ +public interface SuppressionListResource { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the listName property: The name of the suppression list. This value must match one of the valid sender + * usernames of the sending domain. + * + * @return the listName value. + */ + String listName(); + + /** + * Gets the lastUpdatedTimestamp property: The date the resource was last updated. + * + * @return the lastUpdatedTimestamp value. + */ + String lastUpdatedTimestamp(); + + /** + * Gets the createdTimestamp property: The date the resource was created. + * + * @return the createdTimestamp value. + */ + String createdTimestamp(); + + /** + * Gets the dataLocation property: The location where the SuppressionListAddress data is stored at rest. This value + * is inherited from the parent Domains resource. + * + * @return the dataLocation value. + */ + String dataLocation(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.communication.fluent.models.SuppressionListResourceInner object. + * + * @return the inner object. + */ + SuppressionListResourceInner innerModel(); + + /** + * The entirety of the SuppressionListResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The SuppressionListResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SuppressionListResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SuppressionListResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, emailServiceName, domainName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @return the next definition stage. + */ + WithCreate withExistingDomain(String resourceGroupName, String emailServiceName, String domainName); + } + + /** + * The stage of the SuppressionListResource 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.WithListName { + /** + * Executes the create request. + * + * @return the created resource. + */ + SuppressionListResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SuppressionListResource create(Context context); + } + + /** + * The stage of the SuppressionListResource definition allowing to specify listName. + */ + interface WithListName { + /** + * Specifies the listName property: The name of the suppression list. This value must match one of the valid + * sender usernames of the sending domain.. + * + * @param listName The name of the suppression list. This value must match one of the valid sender usernames + * of the sending domain. + * @return the next definition stage. + */ + WithCreate withListName(String listName); + } + } + + /** + * Begins update for the SuppressionListResource resource. + * + * @return the stage of resource update. + */ + SuppressionListResource.Update update(); + + /** + * The template for SuppressionListResource update. + */ + interface Update extends UpdateStages.WithListName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SuppressionListResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SuppressionListResource apply(Context context); + } + + /** + * The SuppressionListResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SuppressionListResource update allowing to specify listName. + */ + interface WithListName { + /** + * Specifies the listName property: The name of the suppression list. This value must match one of the valid + * sender usernames of the sending domain.. + * + * @param listName The name of the suppression list. This value must match one of the valid sender usernames + * of the sending domain. + * @return the next definition stage. + */ + Update withListName(String listName); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SuppressionListResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SuppressionListResource refresh(Context context); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListResourceCollection.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListResourceCollection.java new file mode 100644 index 000000000000..059639d7d407 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListResourceCollection.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.models.SuppressionListResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A class representing a Domains SuppressionListResource collection. + */ +@Fluent +public final class SuppressionListResourceCollection implements JsonSerializable { + /* + * List of SuppressionListResource + */ + private List value; + + /* + * The URL the client should use to fetch the next page (per server side paging). + */ + private String nextLink; + + /** + * Creates an instance of SuppressionListResourceCollection class. + */ + public SuppressionListResourceCollection() { + } + + /** + * Get the value property: List of SuppressionListResource. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of SuppressionListResource. + * + * @param value the value value to set. + * @return the SuppressionListResourceCollection object itself. + */ + public SuppressionListResourceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL the client should use to fetch the next page (per server side paging). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL the client should use to fetch the next page (per server side paging). + * + * @param nextLink the nextLink value to set. + * @return the SuppressionListResourceCollection object itself. + */ + public SuppressionListResourceCollection withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * 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.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuppressionListResourceCollection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuppressionListResourceCollection 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 SuppressionListResourceCollection. + */ + public static SuppressionListResourceCollection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SuppressionListResourceCollection deserializedSuppressionListResourceCollection + = new SuppressionListResourceCollection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SuppressionListResourceInner.fromJson(reader1)); + deserializedSuppressionListResourceCollection.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSuppressionListResourceCollection.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSuppressionListResourceCollection; + }); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionLists.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionLists.java new file mode 100644 index 000000000000..bf22eb6235c9 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionLists.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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 SuppressionLists. + */ +public interface SuppressionLists { + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByDomain(String resourceGroupName, String emailServiceName, + String domainName); + + /** + * List + * + * List all suppression lists for a domains resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains 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 a class representing a Domains SuppressionListResource collection as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByDomain(String resourceGroupName, String emailServiceName, + String domainName, Context context); + + /** + * Get + * + * Get a SuppressionList resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 SuppressionList resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, Context context); + + /** + * Get + * + * Get a SuppressionList resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 SuppressionList resource. + */ + SuppressionListResource get(String resourceGroupName, String emailServiceName, String domainName, + String suppressionListName); + + /** + * Delete + * + * Delete a SuppressionList. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 emailServiceName, String domainName, + String suppressionListName, Context context); + + /** + * Delete + * + * Delete a SuppressionList. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param emailServiceName The name of the EmailService resource. + * @param domainName The name of the Domains resource. + * @param suppressionListName The name of the suppression list. + * @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 emailServiceName, String domainName, String suppressionListName); + + /** + * Get + * + * Get a SuppressionList resource. + * + * @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 a SuppressionList resource along with {@link Response}. + */ + SuppressionListResource getById(String id); + + /** + * Get + * + * Get a SuppressionList resource. + * + * @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 a SuppressionList resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete + * + * Delete a SuppressionList. + * + * @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); + + /** + * Delete + * + * Delete a SuppressionList. + * + * @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 SuppressionListResource resource. + * + * @param name resource name. + * @return the first stage of the new SuppressionListResource definition. + */ + SuppressionListResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communication/proxy-config.json b/sdk/communication/azure-resourcemanager-communication/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communication/proxy-config.json index 814adfa4e50f..b963f5049be3 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communication/proxy-config.json +++ b/sdk/communication/azure-resourcemanager-communication/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communication/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.communication.implementation.CommunicationServicesClientImpl$CommunicationServicesService"],["com.azure.resourcemanager.communication.implementation.DomainsClientImpl$DomainsService"],["com.azure.resourcemanager.communication.implementation.EmailServicesClientImpl$EmailServicesService"],["com.azure.resourcemanager.communication.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.communication.implementation.SenderUsernamesClientImpl$SenderUsernamesService"]] \ No newline at end of file +[["com.azure.resourcemanager.communication.implementation.CommunicationServicesClientImpl$CommunicationServicesService"],["com.azure.resourcemanager.communication.implementation.DomainsClientImpl$DomainsService"],["com.azure.resourcemanager.communication.implementation.EmailServicesClientImpl$EmailServicesService"],["com.azure.resourcemanager.communication.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.communication.implementation.SenderUsernamesClientImpl$SenderUsernamesService"],["com.azure.resourcemanager.communication.implementation.SmtpUsernamesClientImpl$SmtpUsernamesService"],["com.azure.resourcemanager.communication.implementation.SuppressionListAddressesClientImpl$SuppressionListAddressesService"],["com.azure.resourcemanager.communication.implementation.SuppressionListsClientImpl$SuppressionListsService"]] \ No newline at end of file diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/resources/azure-resourcemanager-communication.properties b/sdk/communication/azure-resourcemanager-communication/src/main/resources/azure-resourcemanager-communication.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/resources/azure-resourcemanager-communication.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilitySamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilitySamples.java index f2b2def9dd72..d26cf4d49614 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilitySamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilitySamples.java @@ -12,7 +12,7 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/checkNameAvailabilityAvailable.json */ /** @@ -29,7 +29,7 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/checkNameAvailabilityUnavailable.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateSamples.java index 2885f33fe237..fdf80aaf58fc 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateSamples.java @@ -6,6 +6,7 @@ import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; /** * Samples for CommunicationServices CreateOrUpdate. @@ -13,7 +14,7 @@ public final class CommunicationServicesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/createOrUpdate.json */ /** @@ -32,7 +33,28 @@ public static void createOrUpdateResource(com.azure.resourcemanager.communicatio /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ + * communicationServices/createOrUpdateWithPublicNetworkAccess.json + */ + /** + * Sample code: Create or update resource with PublicNetworkAccess. + * + * @param manager Entry point to CommunicationManager. + */ + public static void createOrUpdateResourceWithPublicNetworkAccess( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withDataLocation("United States") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .create(); + } + + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/createOrUpdateWithSystemAssignedIdentity.json */ /** @@ -50,4 +72,25 @@ public static void createOrUpdateResourceWithManagedIdentity( .withDataLocation("United States") .create(); } + + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ + * communicationServices/createOrUpdateWithDisableLocalAuth.json + */ + /** + * Sample code: Create or update resource with DisableLocalAuth. + * + * @param manager Entry point to CommunicationManager. + */ + public static void createOrUpdateResourceWithDisableLocalAuth( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withDataLocation("United States") + .withDisableLocalAuth(true) + .create(); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java index 703e279188da..924918589ba8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java @@ -10,7 +10,7 @@ public final class CommunicationServicesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/delete.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupSamples.java index ff6665ac2c03..efdc1e400e24 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupSamples.java @@ -10,7 +10,7 @@ public final class CommunicationServicesGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/get.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubSamples.java index c6d21ee609e1..34ac173ddba3 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubSamples.java @@ -12,7 +12,7 @@ public final class CommunicationServicesLinkNotificationHubSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/linkNotificationHub.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupSamples.java index 341fcfbc849c..7bfef66660e5 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupSamples.java @@ -10,7 +10,7 @@ public final class CommunicationServicesListByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/listByResourceGroup.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListKeysSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListKeysSamples.java index 937f1dbe0157..80e61407a5fc 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListKeysSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListKeysSamples.java @@ -10,7 +10,7 @@ public final class CommunicationServicesListKeysSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/listKeys.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListSamples.java index bd0f4147bed3..f856ae7edff4 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListSamples.java @@ -10,7 +10,7 @@ public final class CommunicationServicesListSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/listBySubscription.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesRegenerateKeySamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesRegenerateKeySamples.java index f53f42e767da..02a808603f35 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesRegenerateKeySamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesRegenerateKeySamples.java @@ -13,7 +13,7 @@ public final class CommunicationServicesRegenerateKeySamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/regenerateKey.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesUpdateSamples.java index b0c1204370e1..d48784eb471a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesUpdateSamples.java @@ -7,6 +7,7 @@ import com.azure.resourcemanager.communication.models.CommunicationServiceResource; import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.HashMap; import java.util.Map; @@ -17,7 +18,7 @@ public final class CommunicationServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/update.json */ /** @@ -35,7 +36,7 @@ public static void updateResource(com.azure.resourcemanager.communication.Commun /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/updateWithUserAssignedIdentity.json */ /** @@ -58,7 +59,48 @@ public static void updateResourceToAddAUserAssignedManagedIdentity( /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ + * communicationServices/updateWithPublicNetworkAccess.json + */ + /** + * Sample code: Update resource to add PublicNetworkAccess. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + updateResourceToAddPublicNetworkAccess(com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .apply(); + } + + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ + * communicationServices/updateWithDisableLocalAuth.json + */ + /** + * Sample code: Update resource to add DisableLocalAuth. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + updateResourceToAddDisableLocalAuth(com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("newTag", "newVal")).withDisableLocalAuth(true).apply(); + } + + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/updateWithSystemAssignedIdentity.json */ /** @@ -80,7 +122,7 @@ public static void updateResourceToAddASystemAssignedManagedIdentity( /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/updateRemoveSystemIdentity.json */ /** @@ -102,7 +144,7 @@ public static void updateResourceToAddASystemAssignedManagedIdentity( /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/updateWithSystemAndUserIdentity.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCancelVerificationSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCancelVerificationSamples.java index 6b988ec97d3b..80316fb291ff 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCancelVerificationSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCancelVerificationSamples.java @@ -13,7 +13,7 @@ public final class DomainsCancelVerificationSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/ * cancelVerification.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateSamples.java index 727249420c67..c995e4eb5d3e 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateSamples.java @@ -12,7 +12,7 @@ public final class DomainsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/ * createOrUpdate.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsDeleteSamples.java index 0ba66faf90aa..ec50925dfd09 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsDeleteSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsDeleteSamples.java @@ -10,7 +10,7 @@ public final class DomainsDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/delete. + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/delete. * json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsGetSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsGetSamples.java index abc3106b1eee..dee8c001400f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsGetSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsGetSamples.java @@ -10,7 +10,7 @@ public final class DomainsGetSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/get.json + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/get.json */ /** * Sample code: Get Domains resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsInitiateVerificationSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsInitiateVerificationSamples.java index ab5b371351bf..4558220a482b 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsInitiateVerificationSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsInitiateVerificationSamples.java @@ -13,7 +13,7 @@ public final class DomainsInitiateVerificationSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/ * initiateVerification.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceSamples.java index dba15c81b5aa..fdf3315426eb 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceSamples.java @@ -10,7 +10,7 @@ public final class DomainsListByEmailServiceResourceSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/ * listByEmailService.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsUpdateSamples.java index 28333abdfb60..3f5506d22ee4 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsUpdateSamples.java @@ -13,7 +13,7 @@ public final class DomainsUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/update. + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/domains/update. * json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateSamples.java index d9db566d39aa..0fdb328f7db4 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateSamples.java @@ -10,7 +10,7 @@ public final class EmailServicesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * createOrUpdate.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteSamples.java index f2f87f8196bf..8d5e0cc618e9 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteSamples.java @@ -10,7 +10,7 @@ public final class EmailServicesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * delete.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupSamples.java index 3b1209179819..6b38c9265c2f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupSamples.java @@ -10,7 +10,7 @@ public final class EmailServicesGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/get + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/get * .json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupSamples.java index 71e848533b30..510a9dd61824 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupSamples.java @@ -10,7 +10,7 @@ public final class EmailServicesListByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * listByResourceGroup.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListSamples.java index 6c08aae8b9bf..83e1110dd4da 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListSamples.java @@ -10,7 +10,7 @@ public final class EmailServicesListSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * listBySubscription.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsSamples.java index 577b34d64a73..b016d3352fd9 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsSamples.java @@ -10,7 +10,7 @@ public final class EmailServicesListVerifiedExchangeOnlineDomainsSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * getVerifiedExchangeOnlineDomains.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesUpdateSamples.java index 90abf280286a..466c124d313f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesUpdateSamples.java @@ -14,7 +14,7 @@ public final class EmailServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/emailServices/ * update.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/OperationsListSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/OperationsListSamples.java index 4585b92af172..aca7851285bf 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/OperationsListSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/OperationsListSamples.java @@ -10,7 +10,7 @@ public final class OperationsListSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/ * communicationServices/operationsList.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateSamples.java index 7e1519ac0dd0..b9982442f23d 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateSamples.java @@ -10,7 +10,7 @@ public final class SenderUsernamesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/senderUsernames/ * createOrUpdate.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteSamples.java index 5abb8137e29b..fe69c590c5d6 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteSamples.java @@ -10,7 +10,7 @@ public final class SenderUsernamesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/senderUsernames/ * delete.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetSamples.java index 0cd27a5bc6e3..8490d5269786 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetSamples.java @@ -10,7 +10,7 @@ public final class SenderUsernamesGetSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/senderUsernames/ * get.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsSamples.java index bfeeade7fd4d..45276bc01826 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsSamples.java @@ -10,7 +10,7 @@ public final class SenderUsernamesListByDomainsSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/senderUsernames/ * listByDomain.json */ /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..df2a45974888 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SmtpUsernames CreateOrUpdate. + */ +public final class SmtpUsernamesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/smtpUsername/ + * createOrUpdate.json + */ + /** + * Sample code: CreateOrUpdate SmtpUsername resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + createOrUpdateSmtpUsernameResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.smtpUsernames() + .define("smtpusername1") + .withExistingCommunicationService("contosoResourceGroup", "contosoACSService") + .withUsername("newuser1@contoso.com") + .withEntraApplicationId("aaaa1111-bbbb-2222-3333-aaaa111122bb") + .withTenantId("aaaa1111-bbbb-2222-3333-aaaa11112222") + .create(); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesDeleteSamples.java new file mode 100644 index 000000000000..39948ef27af2 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SmtpUsernames Delete. + */ +public final class SmtpUsernamesDeleteSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/smtpUsername/ + * delete.json + */ + /** + * Sample code: Delete a SmtpUsername resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + deleteASmtpUsernameResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.smtpUsernames() + .deleteWithResponse("MyResourceGroup", "contosoACSService", "smtpusername1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesGetSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesGetSamples.java new file mode 100644 index 000000000000..d904e93a7b0d --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SmtpUsernames Get. + */ +public final class SmtpUsernamesGetSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/smtpUsername/get. + * json + */ + /** + * Sample code: Get a SmtpUsername resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void getASmtpUsernameResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.smtpUsernames() + .getWithResponse("contosoResourceGroup", "contosoACSService", "smtpusername1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesListSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesListSamples.java new file mode 100644 index 000000000000..1dd0f98e76be --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SmtpUsernames List. + */ +public final class SmtpUsernamesListSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/smtpUsername/ + * getAll.json + */ + /** + * Sample code: Get all SmtpUsername resources for a CommunicationService resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void getAllSmtpUsernameResourcesForACommunicationServiceResource( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.smtpUsernames().list("contosoResourceGroup", "contosoACSService", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..b469f40560d8 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SuppressionListAddresses CreateOrUpdate. + */ +public final class SuppressionListAddressesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * createOrUpdateAddress.json + */ + /** + * Sample code: CreateOrUpdate SuppressionListAddress resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void createOrUpdateSuppressionListAddressResource( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionListAddresses() + .define("11112222-3333-4444-5555-aaaabbbbcccc") + .withExistingSuppressionList("contosoResourceGroup", "contosoEmailService", "contoso.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222") + .withEmail("newuser1@fabrikam.com") + .withFirstName("updatedFirstName") + .create(); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesDeleteSamples.java new file mode 100644 index 000000000000..f7c8dc18645f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SuppressionListAddresses Delete. + */ +public final class SuppressionListAddressesDeleteSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * deleteAddress.json + */ + /** + * Sample code: Delete a SuppressionListAddress resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + deleteASuppressionListAddressResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionListAddresses() + .deleteWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222", "11112222-3333-4444-5555-999999999999", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesGetSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesGetSamples.java new file mode 100644 index 000000000000..3fad97e4f263 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SuppressionListAddresses Get. + */ +public final class SuppressionListAddressesGetSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * getAddress.json + */ + /** + * Sample code: Get a SuppressionListAddress resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + getASuppressionListAddressResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionListAddresses() + .getWithResponse("contosoResourceGroup", "contosoEmailService", "contoso.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222", "11112222-3333-4444-5555-aaaabbbbcccc", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesListSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesListSamples.java new file mode 100644 index 000000000000..9ddef0c12ac6 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SuppressionListAddresses List. + */ +public final class SuppressionListAddressesListSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * getAddresses.json + */ + /** + * Sample code: Get all SuppressionListAddresses resources for a SuppressionList resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void getAllSuppressionListAddressesResourcesForASuppressionListResource( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionListAddresses() + .list("contosoResourceGroup", "contosoEmailService", "contoso.com", "aaaa1111-bbbb-2222-3333-aaaa11112222", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..6348f137074f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SuppressionLists CreateOrUpdate. + */ +public final class SuppressionListsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * createOrUpdateSuppressionList.json + */ + /** + * Sample code: CreateOrUpdate SuppressionLists resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + createOrUpdateSuppressionListsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionLists() + .define("aaaa1111-bbbb-2222-3333-aaaa11112222") + .withExistingDomain("contosoResourceGroup", "contosoEmailService", "contoso.com") + .withListName("contosoNewsAlerts") + .create(); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsDeleteSamples.java new file mode 100644 index 000000000000..0245a28e81da --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SuppressionLists Delete. + */ +public final class SuppressionListsDeleteSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * deleteSuppressionList.json + */ + /** + * Sample code: Delete a SuppressionLists resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + deleteASuppressionListsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionLists() + .deleteWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsGetSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsGetSamples.java new file mode 100644 index 000000000000..886df35fa4e0 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SuppressionLists Get. + */ +public final class SuppressionListsGetSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * getSuppressionList.json + */ + /** + * Sample code: Get a SuppressionList resource. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + getASuppressionListResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionLists() + .getWithResponse("contosoResourceGroup", "contosoEmailService", "contoso.com", + "aaaa1111-bbbb-2222-3333-aaaa11112222", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsListByDomainSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsListByDomainSamples.java new file mode 100644 index 000000000000..fcbe38854077 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsListByDomainSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +/** + * Samples for SuppressionLists ListByDomain. + */ +public final class SuppressionListsListByDomainSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/stable/2025-09-01/examples/suppressionLists/ + * getSuppressionLists.json + */ + /** + * Sample code: Get all SuppressionLists resources. + * + * @param manager Entry point to CommunicationManager. + */ + public static void + getAllSuppressionListsResources(com.azure.resourcemanager.communication.CommunicationManager manager) { + manager.suppressionLists() + .listByDomain("contosoResourceGroup", "contosoEmailService", "contoso.com", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CheckNameAvailabilityResponseInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CheckNameAvailabilityResponseInnerTests.java index 673aadbf309b..bba5401c6a17 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CheckNameAvailabilityResponseInnerTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CheckNameAvailabilityResponseInnerTests.java @@ -15,7 +15,7 @@ public void testDeserialize() throws Exception { CheckNameAvailabilityResponseInner model = BinaryData .fromString("{\"nameAvailable\":false,\"reason\":\"AlreadyExists\",\"message\":\"iwbybrkxvdumjg\"}") .toObject(CheckNameAvailabilityResponseInner.class); - Assertions.assertEquals(false, model.nameAvailable()); + Assertions.assertFalse(model.nameAvailable()); Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, model.reason()); Assertions.assertEquals("iwbybrkxvdumjg", model.message()); } @@ -26,7 +26,7 @@ public void testSerialize() throws Exception { .withReason(CheckNameAvailabilityReason.ALREADY_EXISTS) .withMessage("iwbybrkxvdumjg"); model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityResponseInner.class); - Assertions.assertEquals(false, model.nameAvailable()); + Assertions.assertFalse(model.nameAvailable()); Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, model.reason()); Assertions.assertEquals("iwbybrkxvdumjg", model.message()); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java index ea670610f29b..3a426e06cff1 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java @@ -6,6 +6,7 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceProperties; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -13,18 +14,24 @@ public final class CommunicationServicePropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { CommunicationServiceProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Running\",\"hostName\":\"cuertu\",\"dataLocation\":\"kdosvqw\",\"notificationHubId\":\"mdgbbjfdd\",\"version\":\"bmbexppbhtqqro\",\"immutableResourceId\":\"p\",\"linkedDomains\":[\"algbquxigjyjg\"]}") + "{\"provisioningState\":\"Deleting\",\"hostName\":\"gcue\",\"dataLocation\":\"tumkdosvqwhbm\",\"notificationHubId\":\"bbjfddgmbmbexp\",\"version\":\"htqqrolfp\",\"immutableResourceId\":\"s\",\"linkedDomains\":[\"bquxigjy\",\"gzjaoyfhrtxilne\"],\"publicNetworkAccess\":\"Disabled\",\"disableLocalAuth\":true}") .toObject(CommunicationServiceProperties.class); - Assertions.assertEquals("kdosvqw", model.dataLocation()); - Assertions.assertEquals("algbquxigjyjg", model.linkedDomains().get(0)); + Assertions.assertEquals("tumkdosvqwhbm", model.dataLocation()); + Assertions.assertEquals("bquxigjy", model.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + Assertions.assertTrue(model.disableLocalAuth()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - CommunicationServiceProperties model = new CommunicationServiceProperties().withDataLocation("kdosvqw") - .withLinkedDomains(Arrays.asList("algbquxigjyjg")); + CommunicationServiceProperties model = new CommunicationServiceProperties().withDataLocation("tumkdosvqwhbm") + .withLinkedDomains(Arrays.asList("bquxigjy", "gzjaoyfhrtxilne")) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .withDisableLocalAuth(true); model = BinaryData.fromObject(model).toObject(CommunicationServiceProperties.class); - Assertions.assertEquals("kdosvqw", model.dataLocation()); - Assertions.assertEquals("algbquxigjyjg", model.linkedDomains().get(0)); + Assertions.assertEquals("tumkdosvqwhbm", model.dataLocation()); + Assertions.assertEquals("bquxigjy", model.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + Assertions.assertTrue(model.disableLocalAuth()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java index 257db00321de..69e615d0278b 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java @@ -8,6 +8,7 @@ import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.Arrays; import java.util.HashMap; @@ -18,30 +19,37 @@ public final class CommunicationServiceResourceInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { CommunicationServiceResourceInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Updating\",\"hostName\":\"ljfmppee\",\"dataLocation\":\"vmgxsab\",\"notificationHubId\":\"qduujitcjczdz\",\"version\":\"ndhkrw\",\"immutableResourceId\":\"appd\",\"linkedDomains\":[\"kvwrwjfeu\",\"nhutjeltmrldhugj\",\"zdatqxhocdg\"]},\"identity\":{\"principalId\":\"2049c5f2-861c-4d83-ac49-7474d7161b2b\",\"tenantId\":\"f04f38f3-fdcc-4093-8992-7f5396a04652\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"icndvkaozwyifty\":{\"principalId\":\"bea5f7ef-00db-4c7e-88cd-ec5e196435e5\",\"clientId\":\"400295cc-b3fb-4d22-85fd-878ab8a4012e\"},\"urokft\":{\"principalId\":\"75131617-1977-4aa3-867a-97da3786a1e3\",\"clientId\":\"5856fe72-522d-4e3b-963f-93516cfdbe23\"},\"lniwpwcukjfkgiaw\":{\"principalId\":\"d965a623-6078-4900-87f4-e7d91afdefcf\",\"clientId\":\"2e80c760-1b47-4b21-b601-892cc7906f2d\"}}},\"location\":\"lryplwckbasyy\",\"tags\":{\"phejkotynqgoulz\":\"dhsgcba\",\"gakeqsr\":\"dlikwyqkgfgibma\",\"qqedqytbciqfou\":\"yb\"},\"id\":\"lmmnkzsmodmglo\",\"name\":\"gpbkwtmut\",\"type\":\"uqktap\"}") + "{\"properties\":{\"provisioningState\":\"Unknown\",\"hostName\":\"krwpdap\",\"dataLocation\":\"dsbdkvwrwjf\",\"notificationHubId\":\"snhu\",\"version\":\"eltmrldhugjzzdat\",\"immutableResourceId\":\"hocdgeab\",\"linkedDomains\":[\"huticndvkao\"],\"publicNetworkAccess\":\"SecuredByPerimeter\",\"disableLocalAuth\":true},\"identity\":{\"principalId\":\"ee3d173b-0ffe-42c5-a519-46b4cd1835a1\",\"tenantId\":\"af92ca37-58a9-46a3-b14c-d3e899653a80\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"k\":{\"principalId\":\"ad1c96d7-8ce3-4ec1-8e64-013ca474b5d9\",\"clientId\":\"66f33b4a-5547-43fe-815c-e11e2ffe3789\"},\"xolniwpwcukjfk\":{\"principalId\":\"dcd2ddf5-f3c1-438f-a5be-2e8f8c84ce35\",\"clientId\":\"9e3fce2b-4859-4c20-83e7-805cda745885\"}}},\"location\":\"awxklr\",\"tags\":{\"hsgcbacphejkot\":\"wckbasyypnd\",\"wyqkgfgibm\":\"nqgoulzndli\",\"qsrxybzqqed\":\"dgak\",\"iqfouflmmnkz\":\"ytb\"},\"id\":\"modmglougpb\",\"name\":\"wtmutduq\",\"type\":\"ta\"}") .toObject(CommunicationServiceResourceInner.class); - Assertions.assertEquals("lryplwckbasyy", model.location()); - Assertions.assertEquals("dhsgcba", model.tags().get("phejkotynqgoulz")); - Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); - Assertions.assertEquals("vmgxsab", model.dataLocation()); - Assertions.assertEquals("kvwrwjfeu", model.linkedDomains().get(0)); + Assertions.assertEquals("awxklr", model.location()); + Assertions.assertEquals("wckbasyypnd", model.tags().get("hsgcbacphejkot")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("dsbdkvwrwjf", model.dataLocation()); + Assertions.assertEquals("huticndvkao", model.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.SECURED_BY_PERIMETER, model.publicNetworkAccess()); + Assertions.assertTrue(model.disableLocalAuth()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - CommunicationServiceResourceInner model = new CommunicationServiceResourceInner().withLocation("lryplwckbasyy") - .withTags(mapOf("phejkotynqgoulz", "dhsgcba", "gakeqsr", "dlikwyqkgfgibma", "qqedqytbciqfou", "yb")) - .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities(mapOf("icndvkaozwyifty", new UserAssignedIdentity(), "urokft", - new UserAssignedIdentity(), "lniwpwcukjfkgiaw", new UserAssignedIdentity()))) - .withDataLocation("vmgxsab") - .withLinkedDomains(Arrays.asList("kvwrwjfeu", "nhutjeltmrldhugj", "zdatqxhocdg")); + CommunicationServiceResourceInner model = new CommunicationServiceResourceInner().withLocation("awxklr") + .withTags(mapOf("hsgcbacphejkot", "wckbasyypnd", "wyqkgfgibm", "nqgoulzndli", "qsrxybzqqed", "dgak", + "iqfouflmmnkz", "ytb")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities( + mapOf("k", new UserAssignedIdentity(), "xolniwpwcukjfk", new UserAssignedIdentity()))) + .withDataLocation("dsbdkvwrwjf") + .withLinkedDomains(Arrays.asList("huticndvkao")) + .withPublicNetworkAccess(PublicNetworkAccess.SECURED_BY_PERIMETER) + .withDisableLocalAuth(true); model = BinaryData.fromObject(model).toObject(CommunicationServiceResourceInner.class); - Assertions.assertEquals("lryplwckbasyy", model.location()); - Assertions.assertEquals("dhsgcba", model.tags().get("phejkotynqgoulz")); - Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); - Assertions.assertEquals("vmgxsab", model.dataLocation()); - Assertions.assertEquals("kvwrwjfeu", model.linkedDomains().get(0)); + Assertions.assertEquals("awxklr", model.location()); + Assertions.assertEquals("wckbasyypnd", model.tags().get("hsgcbacphejkot")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("dsbdkvwrwjf", model.dataLocation()); + Assertions.assertEquals("huticndvkao", model.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.SECURED_BY_PERIMETER, model.publicNetworkAccess()); + Assertions.assertTrue(model.disableLocalAuth()); } // Use "Map.of" if available diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java index 32e1755b0da4..825e823f8e99 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java @@ -9,6 +9,7 @@ import com.azure.resourcemanager.communication.models.CommunicationServiceResourceList; import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.Arrays; import java.util.HashMap; @@ -19,46 +20,57 @@ public final class CommunicationServiceResourceListTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { CommunicationServiceResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"mkkvnip\",\"dataLocation\":\"oxzjnchgejspod\",\"notificationHubId\":\"ilzyd\",\"version\":\"o\",\"immutableResourceId\":\"yahux\",\"linkedDomains\":[\"mqnjaqw\",\"xj\"]},\"identity\":{\"principalId\":\"a48a4236-5bf9-4497-a6db-8984afd5da4f\",\"tenantId\":\"06b33ecb-7f5f-43be-9aa9-1d937cef642f\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"tegjvwmf\":{\"principalId\":\"d26ff5bf-8e56-44f4-937d-c76beede9c4a\",\"clientId\":\"081e3926-3f3e-49f6-bde8-a54e4572e5ce\"},\"scmdvpjhulsuu\":{\"principalId\":\"8ccd6c16-28da-4202-b247-e417226c45b5\",\"clientId\":\"be59347b-67fd-47e3-8d43-54e70e187218\"},\"jozkrwfndiod\":{\"principalId\":\"1e8b161d-e3d3-4cc8-ba9b-ce1bdef52317\",\"clientId\":\"851e90bc-8565-44ae-a534-a073f0f75c60\"},\"lwejdpv\":{\"principalId\":\"7f3c9a13-78f0-490e-8f3a-e84aa947d196\",\"clientId\":\"2738c0e6-30c2-4391-8c41-78b33aeb9e75\"}}},\"location\":\"yoqpsoaccta\",\"tags\":{\"dfdosygexp\":\"ljlahbcryf\",\"dphlxaolt\":\"ojakhmsbzjhcrze\"},\"id\":\"qtrgqjbpfzfsinzg\",\"name\":\"f\",\"type\":\"jrwzox\"},{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"lluwfzitonpeq\",\"dataLocation\":\"pjkjlxofpdv\",\"notificationHubId\":\"fxxypininmayhuy\",\"version\":\"kpode\",\"immutableResourceId\":\"oginuvamiheognar\",\"linkedDomains\":[\"theotusiv\"]},\"identity\":{\"principalId\":\"2bff9112-f8cb-42f0-8ba7-1f3fc6dadb8d\",\"tenantId\":\"c96242e7-f75b-4663-a8b5-7b5b450c865f\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"nhungbw\":{\"principalId\":\"3539c26a-45b3-4284-a606-028e879987a4\",\"clientId\":\"9b26a710-5bf1-4672-8d6e-9b9598c823ea\"}}},\"location\":\"rnfygxgispem\",\"tags\":{\"fxqeof\":\"fkufublj\",\"jqul\":\"aeqjhqjbasvms\",\"clxxwrljdo\":\"gsntnbybkzgcwr\"},\"id\":\"skcqvkocrcjd\",\"name\":\"wtnhxbnjbiksqr\",\"type\":\"lssai\"}],\"nextLink\":\"p\"}") + "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"mkkvnip\",\"dataLocation\":\"oxzjnchgejspod\",\"notificationHubId\":\"ilzyd\",\"version\":\"o\",\"immutableResourceId\":\"yahux\",\"linkedDomains\":[\"mqnjaqw\",\"xj\"],\"publicNetworkAccess\":\"SecuredByPerimeter\",\"disableLocalAuth\":true},\"identity\":{\"principalId\":\"60417efb-d681-4e7f-a382-9c7099cf8ba6\",\"tenantId\":\"3b0fdc1d-83f7-42d0-95a8-4dac330b188e\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"vwmf\":{\"principalId\":\"80f17e41-6c39-4e70-ac51-75cee4e6c45c\",\"clientId\":\"7fdaa729-5d28-4002-a8f5-a5395278c694\"}}},\"location\":\"t\",\"tags\":{\"ozkrwfndiodjpslw\":\"dvpjhulsuuvmk\",\"psoacctazakljl\":\"jdpvwryo\",\"paojakhmsbzjh\":\"hbcryffdfdosyge\"},\"id\":\"rzevdphlxaol\",\"name\":\"hqtrgqjbpf\",\"type\":\"fsinzgvfcjrwzoxx\"},{\"properties\":{\"provisioningState\":\"Unknown\",\"hostName\":\"luwfzitonpeqfpjk\",\"dataLocation\":\"lxofpdvhpfxxypin\",\"notificationHubId\":\"mayhuybbkpodepoo\",\"version\":\"nuvamiheogna\",\"immutableResourceId\":\"zxtheotusivyevcc\",\"linkedDomains\":[\"hn\",\"un\"],\"publicNetworkAccess\":\"Disabled\",\"disableLocalAuth\":false},\"identity\":{\"principalId\":\"b6867747-eb62-4dc5-bfc0-4618ad71bd98\",\"tenantId\":\"2962d48f-33b3-4e39-b3ee-bbd9e334d963\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"spemvtzfk\":{\"principalId\":\"2676193f-0c0c-4144-933e-7fa45403445b\",\"clientId\":\"e8cfbe56-fad1-4bf9-bdea-a3dbe981a1f1\"},\"bljofxqeof\":{\"principalId\":\"20a3eb5f-51e0-4fff-8b93-5a74e0480187\",\"clientId\":\"b7157e69-1497-4e9f-981c-ad173197fff6\"},\"qjhqjbas\":{\"principalId\":\"c386d647-9d41-40ba-8683-52124133686e\",\"clientId\":\"27514be4-34fb-4f56-a748-064c15f27c83\"},\"mjqulngsn\":{\"principalId\":\"962bb4ec-d061-46ef-958a-bb40a913fcc1\",\"clientId\":\"0cfbf62e-a986-447b-9076-5644382d54e8\"}}},\"location\":\"bybkzgcwrwclxx\",\"tags\":{\"cqvkocrcjdkwtn\":\"jdous\",\"gls\":\"xbnjbiksq\"},\"id\":\"ainqpjwnzlljfm\",\"name\":\"pee\",\"type\":\"vmgxsab\"}],\"nextLink\":\"qduujitcjczdz\"}") .toObject(CommunicationServiceResourceList.class); - Assertions.assertEquals("yoqpsoaccta", model.value().get(0).location()); - Assertions.assertEquals("ljlahbcryf", model.value().get(0).tags().get("dfdosygexp")); + Assertions.assertEquals("t", model.value().get(0).location()); + Assertions.assertEquals("dvpjhulsuuvmk", model.value().get(0).tags().get("ozkrwfndiodjpslw")); Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.value().get(0).identity().type()); Assertions.assertEquals("oxzjnchgejspod", model.value().get(0).dataLocation()); Assertions.assertEquals("mqnjaqw", model.value().get(0).linkedDomains().get(0)); - Assertions.assertEquals("p", model.nextLink()); + Assertions.assertEquals(PublicNetworkAccess.SECURED_BY_PERIMETER, model.value().get(0).publicNetworkAccess()); + Assertions.assertTrue(model.value().get(0).disableLocalAuth()); + Assertions.assertEquals("qduujitcjczdz", model.nextLink()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CommunicationServiceResourceList model = new CommunicationServiceResourceList() - .withValue(Arrays.asList( - new CommunicationServiceResourceInner().withLocation("yoqpsoaccta") - .withTags(mapOf("dfdosygexp", "ljlahbcryf", "dphlxaolt", "ojakhmsbzjhcrze")) - .withIdentity(new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities(mapOf("tegjvwmf", new UserAssignedIdentity(), "scmdvpjhulsuu", - new UserAssignedIdentity(), "jozkrwfndiod", new UserAssignedIdentity(), "lwejdpv", - new UserAssignedIdentity()))) - .withDataLocation("oxzjnchgejspod") - .withLinkedDomains(Arrays.asList("mqnjaqw", "xj")), - new CommunicationServiceResourceInner().withLocation("rnfygxgispem") - .withTags(mapOf("fxqeof", "fkufublj", "jqul", "aeqjhqjbasvms", "clxxwrljdo", "gsntnbybkzgcwr")) - .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities(mapOf("nhungbw", new UserAssignedIdentity()))) - .withDataLocation("pjkjlxofpdv") - .withLinkedDomains(Arrays.asList("theotusiv")))) - .withNextLink("p"); + .withValue( + Arrays.asList( + new CommunicationServiceResourceInner().withLocation("t") + .withTags(mapOf("ozkrwfndiodjpslw", "dvpjhulsuuvmk", "psoacctazakljl", "jdpvwryo", + "paojakhmsbzjh", "hbcryffdfdosyge")) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("vwmf", new UserAssignedIdentity()))) + .withDataLocation("oxzjnchgejspod") + .withLinkedDomains(Arrays.asList("mqnjaqw", "xj")) + .withPublicNetworkAccess(PublicNetworkAccess.SECURED_BY_PERIMETER) + .withDisableLocalAuth(true), + new CommunicationServiceResourceInner().withLocation("bybkzgcwrwclxx") + .withTags(mapOf("cqvkocrcjdkwtn", "jdous", "gls", "xbnjbiksq")) + .withIdentity( + new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("spemvtzfk", new UserAssignedIdentity(), + "bljofxqeof", new UserAssignedIdentity(), "qjhqjbas", + new UserAssignedIdentity(), "mjqulngsn", new UserAssignedIdentity()))) + .withDataLocation("lxofpdvhpfxxypin") + .withLinkedDomains(Arrays.asList("hn", "un")) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .withDisableLocalAuth(false))) + .withNextLink("qduujitcjczdz"); model = BinaryData.fromObject(model).toObject(CommunicationServiceResourceList.class); - Assertions.assertEquals("yoqpsoaccta", model.value().get(0).location()); - Assertions.assertEquals("ljlahbcryf", model.value().get(0).tags().get("dfdosygexp")); + Assertions.assertEquals("t", model.value().get(0).location()); + Assertions.assertEquals("dvpjhulsuuvmk", model.value().get(0).tags().get("ozkrwfndiodjpslw")); Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.value().get(0).identity().type()); Assertions.assertEquals("oxzjnchgejspod", model.value().get(0).dataLocation()); Assertions.assertEquals("mqnjaqw", model.value().get(0).linkedDomains().get(0)); - Assertions.assertEquals("p", model.nextLink()); + Assertions.assertEquals(PublicNetworkAccess.SECURED_BY_PERIMETER, model.value().get(0).publicNetworkAccess()); + Assertions.assertTrue(model.value().get(0).disableLocalAuth()); + Assertions.assertEquals("qduujitcjczdz", model.nextLink()); } // Use "Map.of" if available diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java index 0ad75909c2ea..d209646c6d08 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java @@ -8,6 +8,7 @@ import com.azure.resourcemanager.communication.models.CommunicationServiceResourceUpdate; import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.Arrays; import java.util.HashMap; @@ -18,24 +19,29 @@ public final class CommunicationServiceResourceUpdateTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { CommunicationServiceResourceUpdate model = BinaryData.fromString( - "{\"properties\":{\"linkedDomains\":[\"jvtbvpyss\",\"dnrujqguhmuouqfp\"]},\"identity\":{\"principalId\":\"76132980-1063-43ff-bc0c-9260b007c498\",\"tenantId\":\"7e6159fe-57d6-4910-bb8e-dd94f62aee64\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"tnwu\":{\"principalId\":\"9bfeb7b2-a122-42dd-b678-bd51d8543049\",\"clientId\":\"2d7f9a1c-417b-4e60-9d90-8b3f3dd55193\"}}},\"tags\":{\"x\":\"a\",\"hr\":\"fizuckyf\"}}") + "{\"properties\":{\"linkedDomains\":[\"nwbxgjvtbvpyssz\",\"nruj\",\"guhmuouqfpr\",\"zw\"],\"publicNetworkAccess\":\"SecuredByPerimeter\",\"disableLocalAuth\":true},\"identity\":{\"principalId\":\"333a619c-80f4-43be-a82b-7410d66ba4d6\",\"tenantId\":\"016b4517-a58d-4f0d-9a71-ded9e2bf5ef4\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"zxufiz\":{\"principalId\":\"765810ea-f84c-454d-968e-fda2b610e46d\",\"clientId\":\"920aa78d-c692-4392-9cc1-d5064a1f8dbe\"}}},\"tags\":{\"i\":\"y\"}}") .toObject(CommunicationServiceResourceUpdate.class); - Assertions.assertEquals("a", model.tags().get("x")); + Assertions.assertEquals("y", model.tags().get("i")); Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); - Assertions.assertEquals("jvtbvpyss", model.linkedDomains().get(0)); + Assertions.assertEquals("nwbxgjvtbvpyssz", model.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.SECURED_BY_PERIMETER, model.publicNetworkAccess()); + Assertions.assertTrue(model.disableLocalAuth()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - CommunicationServiceResourceUpdate model - = new CommunicationServiceResourceUpdate().withTags(mapOf("x", "a", "hr", "fizuckyf")) - .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities(mapOf("tnwu", new UserAssignedIdentity()))) - .withLinkedDomains(Arrays.asList("jvtbvpyss", "dnrujqguhmuouqfp")); + CommunicationServiceResourceUpdate model = new CommunicationServiceResourceUpdate().withTags(mapOf("i", "y")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("zxufiz", new UserAssignedIdentity()))) + .withLinkedDomains(Arrays.asList("nwbxgjvtbvpyssz", "nruj", "guhmuouqfpr", "zw")) + .withPublicNetworkAccess(PublicNetworkAccess.SECURED_BY_PERIMETER) + .withDisableLocalAuth(true); model = BinaryData.fromObject(model).toObject(CommunicationServiceResourceUpdate.class); - Assertions.assertEquals("a", model.tags().get("x")); + Assertions.assertEquals("y", model.tags().get("i")); Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); - Assertions.assertEquals("jvtbvpyss", model.linkedDomains().get(0)); + Assertions.assertEquals("nwbxgjvtbvpyssz", model.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.SECURED_BY_PERIMETER, model.publicNetworkAccess()); + Assertions.assertTrue(model.disableLocalAuth()); } // Use "Map.of" if available diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java index baf6bbdd9698..7db62d05eb62 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java @@ -6,23 +6,30 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceUpdateProperties; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import java.util.Arrays; import org.junit.jupiter.api.Assertions; public final class CommunicationServiceUpdatePropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - CommunicationServiceUpdateProperties model - = BinaryData.fromString("{\"linkedDomains\":[\"fvzwdzuhty\",\"wisdkft\",\"wxmnteiwao\"]}") - .toObject(CommunicationServiceUpdateProperties.class); - Assertions.assertEquals("fvzwdzuhty", model.linkedDomains().get(0)); + CommunicationServiceUpdateProperties model = BinaryData.fromString( + "{\"linkedDomains\":[\"idf\",\"zwdzuh\"],\"publicNetworkAccess\":\"Enabled\",\"disableLocalAuth\":true}") + .toObject(CommunicationServiceUpdateProperties.class); + Assertions.assertEquals("idf", model.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.publicNetworkAccess()); + Assertions.assertTrue(model.disableLocalAuth()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - CommunicationServiceUpdateProperties model = new CommunicationServiceUpdateProperties() - .withLinkedDomains(Arrays.asList("fvzwdzuhty", "wisdkft", "wxmnteiwao")); + CommunicationServiceUpdateProperties model + = new CommunicationServiceUpdateProperties().withLinkedDomains(Arrays.asList("idf", "zwdzuh")) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withDisableLocalAuth(true); model = BinaryData.fromObject(model).toObject(CommunicationServiceUpdateProperties.class); - Assertions.assertEquals("fvzwdzuhty", model.linkedDomains().get(0)); + Assertions.assertEquals("idf", model.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.publicNetworkAccess()); + Assertions.assertTrue(model.disableLocalAuth()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java index 0fafff202bfe..b22d420cfa52 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.CheckNameAvailabilityReason; @@ -22,23 +22,23 @@ public final class CommunicationServicesCheckNameAvailabilityWithResponseMockTests { @Test public void testCheckNameAvailabilityWithResponse() throws Exception { - String responseStr = "{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"eyp\"}"; + String responseStr = "{\"nameAvailable\":true,\"reason\":\"Invalid\",\"message\":\"bh\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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)); CheckNameAvailabilityResponse response = manager.communicationServices() .checkNameAvailabilityWithResponse( - new NameAvailabilityParameters().withName("xzko").withType("cukoklyaxuconu"), + new NameAvailabilityParameters().withName("yudxytlmoy").withType("vwfudwpzntxhd"), com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals(false, response.nameAvailable()); + Assertions.assertTrue(response.nameAvailable()); Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, response.reason()); - Assertions.assertEquals("eyp", response.message()); + Assertions.assertEquals("bh", response.message()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java index c7b3450a93be..b7e8a4dc0479 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java @@ -6,13 +6,14 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -27,32 +28,37 @@ public final class CommunicationServicesCreateOrUpdateMockTests { @Test public void testCreateOrUpdate() throws Exception { String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"hostName\":\"sfwxosowzxc\",\"dataLocation\":\"gicjooxdjeb\",\"notificationHubId\":\"ucww\",\"version\":\"ovbvmeueciv\",\"immutableResourceId\":\"zceuojgjrw\",\"linkedDomains\":[\"iotwmcdytdxwit\",\"nrjawgqwg\",\"hniskxfbkpyc\"]},\"identity\":{\"principalId\":\"3fe3db54-7aa6-4c28-997b-f30b04c93b0b\",\"tenantId\":\"620b147c-fea6-4022-9b3b-18f9659bb674\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"dauwhvylwzbtd\":{\"principalId\":\"de08871c-265c-41a1-a5fd-96bb91f18ec4\",\"clientId\":\"09bbd313-650a-4094-8224-949b1be0ada7\"},\"jznb\":{\"principalId\":\"5e766b65-0963-4241-8a1a-5dfa709e7d9d\",\"clientId\":\"5d5b0eeb-9906-4d45-8a3a-59af98b09f94\"}}},\"location\":\"ow\",\"tags\":{\"lupj\":\"rzqlveu\",\"riplrbpbewtg\":\"khfxobbcswsrt\"},\"id\":\"fgb\",\"name\":\"c\",\"type\":\"wxzvlvqhjkb\"}"; + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"hostName\":\"mnvdfzn\",\"dataLocation\":\"daodvxzbncblyl\",\"notificationHubId\":\"tdbhhxsrzdzu\",\"version\":\"rsc\",\"immutableResourceId\":\"t\",\"linkedDomains\":[\"fiwjmygtdssls\",\"tmweriofzpyq\",\"emwabnet\"],\"publicNetworkAccess\":\"Disabled\",\"disableLocalAuth\":true},\"identity\":{\"principalId\":\"004886f8-de57-43e8-aa5c-74d3faf760a2\",\"tenantId\":\"4987e090-466b-41bf-b7b7-a23c8d2fd219\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"wubmwmbesldn\":{\"principalId\":\"6f01cab6-2bee-455c-a15f-32eecde6e4ea\",\"clientId\":\"533fa957-844d-47d7-b6b0-f6b63265783f\"},\"tppjflcx\":{\"principalId\":\"366b980b-4f8d-4b35-a8fe-7cacab7b2d58\",\"clientId\":\"ca7695ad-110a-4379-9510-665c63c51401\"},\"okonzmnsikvmkqz\":{\"principalId\":\"f3b88ba3-b2f4-4728-8214-55f92687a654\",\"clientId\":\"9876766d-0323-4d1b-9c09-0cb5ea39b591\"},\"kdltfzxmhhvhg\":{\"principalId\":\"681bfdea-cd6a-4cfe-9711-82feec627e8e\",\"clientId\":\"ddcd7b5e-583b-4256-a0a1-4d9fd5a1dabe\"}}},\"location\":\"eodkwobda\",\"tags\":{\"dlkzgxhuri\":\"ibqdxbxwakbogqx\",\"ebxmubyynt\":\"lbpodxunk\",\"tkoievseotgq\":\"lrb\"},\"id\":\"l\",\"name\":\"tmuwlauwzi\",\"type\":\"xbmp\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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)); CommunicationServiceResource response = manager.communicationServices() - .define("kfrlhrxsbky") - .withRegion("hcdhmdual") - .withExistingResourceGroup("bh") - .withTags(mapOf("adm", "qpv", "r", "sr", "fmisg", "vxpvgomz")) + .define("qaqtdoqmcbxvwvxy") + .withRegion("gdrjervnaenqpe") + .withExistingResourceGroup("xivetvt") + .withTags(mapOf("mifthnzdnd", "doy", "nayqi", "l", "hqlkthumaqo", "ynduha", "aolps", "bgycduiertgccym")) .withIdentity( new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities(mapOf("ahvljuaha", new UserAssignedIdentity()))) - .withDataLocation("z") - .withLinkedDomains(Arrays.asList("eyvjusrtslhspkde", "maofmxagkv")) + .withUserAssignedIdentities(mapOf("cjhwq", new UserAssignedIdentity(), "r", + new UserAssignedIdentity(), "wj", new UserAssignedIdentity()))) + .withDataLocation("tkblmpewww") + .withLinkedDomains(Arrays.asList("qfsubcgjbirx", "pybsrfbjfdtw", "sotftpvj", "bexilzznfqqnv")) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .withDisableLocalAuth(true) .create(); - Assertions.assertEquals("ow", response.location()); - Assertions.assertEquals("rzqlveu", response.tags().get("lupj")); - Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); - Assertions.assertEquals("gicjooxdjeb", response.dataLocation()); - Assertions.assertEquals("iotwmcdytdxwit", response.linkedDomains().get(0)); + Assertions.assertEquals("eodkwobda", response.location()); + Assertions.assertEquals("ibqdxbxwakbogqx", response.tags().get("dlkzgxhuri")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, response.identity().type()); + Assertions.assertEquals("daodvxzbncblyl", response.dataLocation()); + Assertions.assertEquals("fiwjmygtdssls", response.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, response.publicNetworkAccess()); + Assertions.assertTrue(response.disableLocalAuth()); } // Use "Map.of" if available diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java index 7fa5ec33f001..172c1e2d5b2e 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import java.nio.charset.StandardCharsets; @@ -25,9 +25,9 @@ public void testDelete() throws Exception { CommunicationManager manager = CommunicationManager.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)); - manager.communicationServices().delete("uscrpabgyepsb", "tazqugxywpmueefj", com.azure.core.util.Context.NONE); + manager.communicationServices().delete("nrmfqjhhk", "bpvjymjhx", com.azure.core.util.Context.NONE); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java index 87eecc5151a1..8fe15a1b06f4 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java @@ -6,12 +6,13 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; @@ -22,23 +23,25 @@ public final class CommunicationServicesGetByResourceGroupWithResponseMockTests @Test public void testGetByResourceGroupWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"vmkfssxqu\",\"dataLocation\":\"kfplgmgsxnk\",\"notificationHubId\":\"kde\",\"version\":\"pvlopwiyighxpkd\",\"immutableResourceId\":\"baiuebbaumny\",\"linkedDomains\":[\"edeojnabc\"]},\"identity\":{\"principalId\":\"41328ceb-1c5c-4f3f-aff3-f016202e24e1\",\"tenantId\":\"fd3cfffb-5b93-4991-b9c0-d30b6bcdf524\",\"type\":\"None\",\"userAssignedIdentities\":{\"ebtfhvpesap\":{\"principalId\":\"3466bbfd-9bd7-4781-b1cc-7d6272bf9a11\",\"clientId\":\"f0c0b132-45ee-43aa-b761-937dc4bc37dd\"},\"dqmh\":{\"principalId\":\"03a7e60f-51af-42f4-80a3-ed5c9df8617a\",\"clientId\":\"93d8697c-01eb-4ab0-ae62-847c9b673772\"},\"htldwk\":{\"principalId\":\"269a836c-a765-492d-ae79-bf1f4b6c3ac6\",\"clientId\":\"f6fbb3f6-4a1c-47e9-b47b-f4533b9352c4\"}}},\"location\":\"xuutkncwscwsv\",\"tags\":{\"rupqsxvnmicy\":\"togt\",\"vei\":\"vce\",\"dhbt\":\"ovnotyfjfcnjbkcn\"},\"id\":\"kphywpnvjto\",\"name\":\"nermcl\",\"type\":\"plpho\"}"; + = "{\"properties\":{\"provisioningState\":\"Moving\",\"hostName\":\"veekgpwozuhkfp\",\"dataLocation\":\"sjyofdx\",\"notificationHubId\":\"us\",\"version\":\"touwaboekqv\",\"immutableResourceId\":\"lns\",\"linkedDomains\":[\"xwyjsflhhc\",\"aln\",\"ixisxyawjoy\",\"qcslyjpkiid\"],\"publicNetworkAccess\":\"SecuredByPerimeter\",\"disableLocalAuth\":true},\"identity\":{\"principalId\":\"bf229f15-d810-4aeb-b9d6-699ad900dc08\",\"tenantId\":\"15cb783d-ddea-42d3-87e4-b1225f9db90d\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"ztfolhbnxk\":{\"principalId\":\"2b8797d1-0741-4b23-ad7c-5944e3dabd1b\",\"clientId\":\"2c3e6383-c037-4b3a-9e49-c0744a42525f\"},\"aulppggd\":{\"principalId\":\"1c3272c3-61dd-49fc-9bd8-9385ad1d12f0\",\"clientId\":\"08f88d4f-4c7d-4a83-887e-945e6df6a0d4\"}}},\"location\":\"napnyiropuhpigv\",\"tags\":{\"txmedj\":\"lgqg\",\"lynqwwncwzzh\":\"c\",\"ellwptfdy\":\"gktrmgucnapkte\",\"rhhuaopppcqeqx\":\"pfqbuaceopzf\"},\"id\":\"lzdahzxctobgbkdm\",\"name\":\"izpost\",\"type\":\"grcfb\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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)); CommunicationServiceResource response = manager.communicationServices() - .getByResourceGroupWithResponse("ovplw", "bhvgy", com.azure.core.util.Context.NONE) + .getByResourceGroupWithResponse("nxipeil", "jzuaejxdultskzbb", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("xuutkncwscwsv", response.location()); - Assertions.assertEquals("togt", response.tags().get("rupqsxvnmicy")); - Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.identity().type()); - Assertions.assertEquals("kfplgmgsxnk", response.dataLocation()); - Assertions.assertEquals("edeojnabc", response.linkedDomains().get(0)); + Assertions.assertEquals("napnyiropuhpigv", response.location()); + Assertions.assertEquals("lgqg", response.tags().get("txmedj")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + Assertions.assertEquals("sjyofdx", response.dataLocation()); + Assertions.assertEquals("xwyjsflhhc", response.linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.SECURED_BY_PERIMETER, response.publicNetworkAccess()); + Assertions.assertTrue(response.disableLocalAuth()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java index 36573d8b4a5f..3e04d6b0ea57 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.LinkNotificationHubParameters; @@ -21,23 +21,21 @@ public final class CommunicationServicesLinkNotificationHubWithResponseMockTests { @Test public void testLinkNotificationHubWithResponse() throws Exception { - String responseStr = "{\"resourceId\":\"civfsnkymuctq\"}"; + String responseStr = "{\"resourceId\":\"hhseyv\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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)); - LinkedNotificationHub response - = manager.communicationServices() - .linkNotificationHubWithResponse("wrmjmwvvjektc", "senhwlrs", - new LinkNotificationHubParameters().withResourceId("frzpwvlqdqgb") - .withConnectionString("qylihkaetckt"), - com.azure.core.util.Context.NONE) - .getValue(); + LinkedNotificationHub response = manager.communicationServices() + .linkNotificationHubWithResponse("kfrlhrxsbky", "pycanuzbpz", + new LinkNotificationHubParameters().withResourceId("afkuwb").withConnectionString("rnwb"), + com.azure.core.util.Context.NONE) + .getValue(); - Assertions.assertEquals("civfsnkymuctq", response.resourceId()); + Assertions.assertEquals("hhseyv", response.resourceId()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java index bc93d780d7ac..53549503065e 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java @@ -7,12 +7,13 @@ 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.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; @@ -23,22 +24,25 @@ public final class CommunicationServicesListByResourceGroupMockTests { @Test public void testListByResourceGroup() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"arbu\",\"dataLocation\":\"rcvpnazzmhjrunmp\",\"notificationHubId\":\"tdbhrbnla\",\"version\":\"xmyskp\",\"immutableResourceId\":\"enbtkcxywny\",\"linkedDomains\":[\"synlqidybyxczfc\"]},\"identity\":{\"principalId\":\"bfa69d02-3968-4be4-9d87-221572df2961\",\"tenantId\":\"7f7c03fd-d58a-4458-be31-beea03acf146\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"p\":{\"principalId\":\"208e16a6-34e2-4569-ab9e-b5cb951b992f\",\"clientId\":\"b1c1f6e7-9275-4a97-b342-c8b013bb8d96\"},\"rqlfktsthsucocmn\":{\"principalId\":\"f3b2b267-72c9-4ff4-9966-7a1094e10fd6\",\"clientId\":\"1148d21d-f15d-499f-ab16-8a29dff049fc\"},\"zt\":{\"principalId\":\"64b63f29-b56f-4b05-a9dd-e343b9fc50a9\",\"clientId\":\"7050f34d-8bcf-4964-b64a-a9f557eaf820\"}}},\"location\":\"twwrqp\",\"tags\":{\"xibxujwbhqwalm\":\"ckzywbiexzfeyue\",\"ux\":\"zyoxaepdkzjan\",\"zt\":\"hdwbavxbniwdjs\"},\"id\":\"dbpgnxytxhp\",\"name\":\"xbzpfzab\",\"type\":\"lcuhxwtctyqiklb\"}]}"; + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"hostName\":\"lve\",\"dataLocation\":\"alupjm\",\"notificationHubId\":\"fxobbcsws\",\"version\":\"jriplrbpbewtghf\",\"immutableResourceId\":\"lcgwxzvlvqh\",\"linkedDomains\":[\"egibtnmxiebww\",\"loayqcgw\",\"tzjuzgwyzmhtxo\",\"gmtsavjcbpwxqpsr\"],\"publicNetworkAccess\":\"Enabled\",\"disableLocalAuth\":true},\"identity\":{\"principalId\":\"320c06ef-ee6b-483b-b2e0-68c8fb19737f\",\"tenantId\":\"54884598-add7-49c1-9242-04b62e5743d3\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"wmdyvxqtay\":{\"principalId\":\"37ffb1c1-acd6-45ee-a634-504ea1629285\",\"clientId\":\"c3bd9472-5a33-483e-9ac2-b1e08d916fd6\"},\"wroyqbexrmcq\":{\"principalId\":\"5ed7284f-a88f-42f3-b2d0-f92c6a6d2152\",\"clientId\":\"e4307ddd-6f96-4d63-9f94-3024e6064194\"}}},\"location\":\"ycnojvknmefqsg\",\"tags\":{\"j\":\"hapjyzhpvgqz\"},\"id\":\"vxdjzlmwlxkvugf\",\"name\":\"zovawjvz\",\"type\":\"nluthnnp\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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.communicationServices().listByResourceGroup("buynhijggm", com.azure.core.util.Context.NONE); + = manager.communicationServices().listByResourceGroup("xujznbmpowu", com.azure.core.util.Context.NONE); - Assertions.assertEquals("twwrqp", response.iterator().next().location()); - Assertions.assertEquals("ckzywbiexzfeyue", response.iterator().next().tags().get("xibxujwbhqwalm")); - Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); - Assertions.assertEquals("rcvpnazzmhjrunmp", response.iterator().next().dataLocation()); - Assertions.assertEquals("synlqidybyxczfc", response.iterator().next().linkedDomains().get(0)); + Assertions.assertEquals("ycnojvknmefqsg", response.iterator().next().location()); + Assertions.assertEquals("hapjyzhpvgqz", response.iterator().next().tags().get("j")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, + response.iterator().next().identity().type()); + Assertions.assertEquals("alupjm", response.iterator().next().dataLocation()); + Assertions.assertEquals("egibtnmxiebww", response.iterator().next().linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, response.iterator().next().publicNetworkAccess()); + Assertions.assertTrue(response.iterator().next().disableLocalAuth()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java index 1bf79cb1d3c9..acbdfaf85de6 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java @@ -7,12 +7,13 @@ 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.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.PublicNetworkAccess; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; @@ -23,22 +24,25 @@ public final class CommunicationServicesListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"brjcxe\",\"dataLocation\":\"fuwutttxf\",\"notificationHubId\":\"rbirphxe\",\"version\":\"yva\",\"immutableResourceId\":\"nljky\",\"linkedDomains\":[\"vuujq\"]},\"identity\":{\"principalId\":\"035dfbb0-5d1e-4ffc-bf04-be730718fd94\",\"tenantId\":\"485907e2-a442-4809-8609-7d135283e863\",\"type\":\"None\",\"userAssignedIdentities\":{\"yoxgvcltbgsnc\":{\"principalId\":\"36231c75-a313-4d96-aaaa-d0a8fc8f220f\",\"clientId\":\"c180ae15-9d61-4f33-a481-5c9ea2b447d9\"},\"jeszzhbijhtxfv\":{\"principalId\":\"a3c39c36-73a4-4a12-83aa-ba4b1b97449a\",\"clientId\":\"971dbf53-b364-4568-8045-1284985aa3dd\"}}},\"location\":\"bfs\",\"tags\":{\"pvecxgodeb\":\"eh\",\"pukgriwflzlfb\":\"qkkrb\",\"qzahmgkbrp\":\"zpuzycisp\"},\"id\":\"y\",\"name\":\"hibnuqqkpika\",\"type\":\"rgvtqag\"}]}"; + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"hostName\":\"slhs\",\"dataLocation\":\"kdeemaofmxagkvtm\",\"notificationHubId\":\"mqkrhahvljuahaqu\",\"version\":\"dhmdua\",\"immutableResourceId\":\"exq\",\"linkedDomains\":[\"adm\",\"sr\"],\"publicNetworkAccess\":\"Enabled\",\"disableLocalAuth\":false},\"identity\":{\"principalId\":\"d7522669-eb2f-4418-8e72-edcdb5c9160c\",\"tenantId\":\"631e3256-50cd-4e37-9a85-d361a8c2bf1e\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"misgwbnb\":{\"principalId\":\"18f3b75b-3cb3-4b63-8109-55aa9942b33b\",\"clientId\":\"dae2f839-0b29-4ec1-a1d9-4bb401be728b\"},\"dawkzbali\":{\"principalId\":\"2599fdbc-fc4c-449b-ac4d-770281c6ffe0\",\"clientId\":\"f09e07dc-6189-4555-98ec-aa49b643b70f\"},\"qhakauhashsf\":{\"principalId\":\"28b30997-d035-42f6-bfd4-b0fb52f7f2b4\",\"clientId\":\"5bf9c7cb-9736-4d07-8172-3ec787bf75d0\"},\"sowzxcugi\":{\"principalId\":\"122176cf-624d-44ec-b004-47ddad3ed7c1\",\"clientId\":\"6c06f343-b98e-4599-8dfd-72a1e6beed07\"}}},\"location\":\"ooxdjebwpuc\",\"tags\":{\"bvmeuecivy\":\"vo\",\"ueiotwmcdyt\":\"zceuojgjrw\",\"it\":\"x\",\"hniskxfbkpyc\":\"nrjawgqwg\"},\"id\":\"klwndnhjdauwhv\",\"name\":\"l\",\"type\":\"zbtd\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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.communicationServices().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("bfs", response.iterator().next().location()); - Assertions.assertEquals("eh", response.iterator().next().tags().get("pvecxgodeb")); - Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.iterator().next().identity().type()); - Assertions.assertEquals("fuwutttxf", response.iterator().next().dataLocation()); - Assertions.assertEquals("vuujq", response.iterator().next().linkedDomains().get(0)); + Assertions.assertEquals("ooxdjebwpuc", response.iterator().next().location()); + Assertions.assertEquals("vo", response.iterator().next().tags().get("bvmeuecivy")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, + response.iterator().next().identity().type()); + Assertions.assertEquals("kdeemaofmxagkvtm", response.iterator().next().dataLocation()); + Assertions.assertEquals("adm", response.iterator().next().linkedDomains().get(0)); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, response.iterator().next().publicNetworkAccess()); + Assertions.assertFalse(response.iterator().next().disableLocalAuth()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java index 365d15b0d378..bcee2f770520 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java @@ -10,9 +10,10 @@ public final class DnsRecordTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - DnsRecord model - = BinaryData.fromString("{\"type\":\"cbkbfkg\",\"name\":\"dkexxppofm\",\"value\":\"x\",\"ttl\":825369958}") - .toObject(DnsRecord.class); + DnsRecord model = BinaryData + .fromString( + "{\"type\":\"fjpgddtocjjxhvp\",\"name\":\"uexhdzx\",\"value\":\"qeojnxqbzvddntw\",\"ttl\":592172158}") + .toObject(DnsRecord.class); } @org.junit.jupiter.api.Test diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java index 4e8bf2f106b3..9be254941307 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java @@ -12,7 +12,7 @@ public final class DomainPropertiesVerificationRecordsTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { DomainPropertiesVerificationRecords model = BinaryData.fromString( - "{\"Domain\":{\"type\":\"qcjm\",\"name\":\"javbqidtqajz\",\"value\":\"l\",\"ttl\":144447336},\"SPF\":{\"type\":\"krlkhbzhfepg\",\"name\":\"qex\",\"value\":\"ocxscpaierhhbcs\",\"ttl\":526297458},\"DKIM\":{\"type\":\"a\",\"name\":\"j\",\"value\":\"dxob\",\"ttl\":1455975978},\"DKIM2\":{\"type\":\"qp\",\"name\":\"kajionpim\",\"value\":\"gstxgcp\",\"ttl\":1867037750},\"DMARC\":{\"type\":\"ajrmvdjwzrlovmc\",\"name\":\"hijco\",\"value\":\"ctbzaq\",\"ttl\":2038129581}}") + "{\"Domain\":{\"type\":\"bqidtqaj\",\"name\":\"ulpkudjkrl\",\"value\":\"bzhfepgzgqexz\",\"ttl\":208705149},\"SPF\":{\"type\":\"c\",\"name\":\"ierhhbcsglummaj\",\"value\":\"aodxo\",\"ttl\":547031215},\"DKIM\":{\"type\":\"k\",\"name\":\"xo\",\"value\":\"jionpimexgstxgc\",\"ttl\":524649765},\"DKIM2\":{\"type\":\"aajrm\",\"name\":\"jwzrl\",\"value\":\"mcl\",\"ttl\":186307619},\"DMARC\":{\"type\":\"oejctbzaqsqsy\",\"name\":\"kbfkg\",\"value\":\"dkexxppofm\",\"ttl\":159547648}}") .toObject(DomainPropertiesVerificationRecords.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java index 8977e58e32fd..b166b641b857 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import java.nio.charset.StandardCharsets; @@ -25,9 +25,9 @@ public void testDelete() throws Exception { CommunicationManager manager = CommunicationManager.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)); - manager.domains().delete("yriwwroyqb", "xrmcqibycnojvk", "mefqsgzvahapjyzh", com.azure.core.util.Context.NONE); + manager.domains().delete("v", "zx", "lvithhqzonosgg", com.azure.core.util.Context.NONE); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java index 6fc86211775d..a88a17ef78d2 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java @@ -14,22 +14,22 @@ public final class EmailServiceResourceInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { EmailServiceResourceInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Updating\",\"dataLocation\":\"igdtopbob\"},\"location\":\"ghmewuam\",\"tags\":{\"t\":\"rzayv\",\"ln\":\"gvdfgiotkftutq\",\"qmi\":\"xlefgugnxkrx\",\"abhjybi\":\"tthzrvqd\"},\"id\":\"ehoqfbowskan\",\"name\":\"ktzlcuiywg\",\"type\":\"ywgndrv\"}") + "{\"properties\":{\"provisioningState\":\"Updating\",\"dataLocation\":\"ftutqxlngxlefgu\"},\"location\":\"xkrxdqmi\",\"tags\":{\"abhjybi\":\"hzrvqd\"},\"id\":\"ehoqfbowskan\",\"name\":\"ktzlcuiywg\",\"type\":\"ywgndrv\"}") .toObject(EmailServiceResourceInner.class); - Assertions.assertEquals("ghmewuam", model.location()); - Assertions.assertEquals("rzayv", model.tags().get("t")); - Assertions.assertEquals("igdtopbob", model.dataLocation()); + Assertions.assertEquals("xkrxdqmi", model.location()); + Assertions.assertEquals("hzrvqd", model.tags().get("abhjybi")); + Assertions.assertEquals("ftutqxlngxlefgu", model.dataLocation()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - EmailServiceResourceInner model = new EmailServiceResourceInner().withLocation("ghmewuam") - .withTags(mapOf("t", "rzayv", "ln", "gvdfgiotkftutq", "qmi", "xlefgugnxkrx", "abhjybi", "tthzrvqd")) - .withDataLocation("igdtopbob"); + EmailServiceResourceInner model = new EmailServiceResourceInner().withLocation("xkrxdqmi") + .withTags(mapOf("abhjybi", "hzrvqd")) + .withDataLocation("ftutqxlngxlefgu"); model = BinaryData.fromObject(model).toObject(EmailServiceResourceInner.class); - Assertions.assertEquals("ghmewuam", model.location()); - Assertions.assertEquals("rzayv", model.tags().get("t")); - Assertions.assertEquals("igdtopbob", model.dataLocation()); + Assertions.assertEquals("xkrxdqmi", model.location()); + Assertions.assertEquals("hzrvqd", model.tags().get("abhjybi")); + Assertions.assertEquals("ftutqxlngxlefgu", model.dataLocation()); } // Use "Map.of" if available diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java index 7d6c559cd88d..2729f5199402 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.EmailServiceResource; @@ -23,26 +23,26 @@ public final class EmailServicesCreateOrUpdateMockTests { @Test public void testCreateOrUpdate() throws Exception { String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"dataLocation\":\"xogaokonzmnsikv\"},\"location\":\"qzeqqkdltfzxm\",\"tags\":{\"dkwobdagx\":\"hgure\"},\"id\":\"ibqdxbxwakbogqx\",\"name\":\"dlkzgxhuri\",\"type\":\"lbpodxunk\"}"; + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"dataLocation\":\"knso\"},\"location\":\"jhxbld\",\"tags\":{\"vokotllxdyh\":\"wrlkdmtn\",\"oocrkvcikhnv\":\"syocogjltdtbnnha\",\"gxk\":\"amqgxqquezikyw\"},\"id\":\"lla\",\"name\":\"melwuipiccjz\",\"type\":\"z\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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)); EmailServiceResource response = manager.emailServices() - .define("mnvdfzn") - .withRegion("hh") - .withExistingResourceGroup("mcwyhzdxssadb") - .withTags(mapOf("wjmy", "zdzucerscdntnevf", "s", "tdss", "emwabnet", "tmweriofzpyq", "d", "hhszh")) - .withDataLocation("dvxzbncblylpst") + .define("n") + .withRegion("ynt") + .withExistingResourceGroup("sgplsakn") + .withTags(mapOf("swsrms", "ihleos", "ox", "yzrpzbchckqqzq", "rwyhqmibzyhwitsm", "ysuiizynkedya")) + .withDataLocation("ljphuopxodl") .create(); - Assertions.assertEquals("qzeqqkdltfzxm", response.location()); - Assertions.assertEquals("hgure", response.tags().get("dkwobdagx")); - Assertions.assertEquals("xogaokonzmnsikv", response.dataLocation()); + Assertions.assertEquals("jhxbld", response.location()); + Assertions.assertEquals("wrlkdmtn", response.tags().get("vokotllxdyh")); + Assertions.assertEquals("knso", response.dataLocation()); } // Use "Map.of" if available diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java index 9fd389f8620b..93b1197faf50 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import java.nio.charset.StandardCharsets; @@ -25,9 +25,9 @@ public void testDelete() throws Exception { CommunicationManager manager = CommunicationManager.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)); - manager.emailServices().delete("j", "n", com.azure.core.util.Context.NONE); + manager.emailServices().delete("ysmocmbqfqvmkcxo", "apvhelxprgly", com.azure.core.util.Context.NONE); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java index 79ff6e600cc6..666dacb2d097 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.EmailServiceResource; @@ -21,21 +21,21 @@ public final class EmailServicesGetByResourceGroupWithResponseMockTests { @Test public void testGetByResourceGroupWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"provisioningState\":\"Running\",\"dataLocation\":\"gylgqgitxmedjvcs\"},\"location\":\"n\",\"tags\":{\"zhxgktrmgucn\":\"ncw\",\"llwptfdy\":\"pkteo\",\"rhhuaopppcqeqx\":\"pfqbuaceopzf\",\"izpost\":\"lzdahzxctobgbkdm\"},\"id\":\"grcfb\",\"name\":\"nrmfqjhhk\",\"type\":\"bpvjymjhx\"}"; + = "{\"properties\":{\"provisioningState\":\"Deleting\",\"dataLocation\":\"odfvuefywsbp\"},\"location\":\"mwyhr\",\"tags\":{\"yzvqt\":\"yftaakcpw\",\"zksmondj\":\"nubexk\"},\"id\":\"quxvypomgkop\",\"name\":\"whojvp\",\"type\":\"jqg\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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)); EmailServiceResource response = manager.emailServices() - .getByResourceGroupWithResponse("bnxknalaulppg", "dtpnapnyiropuhp", com.azure.core.util.Context.NONE) + .getByResourceGroupWithResponse("iyq", "luicpdggkzzlvmbm", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("n", response.location()); - Assertions.assertEquals("ncw", response.tags().get("zhxgktrmgucn")); - Assertions.assertEquals("gylgqgitxmedjvcs", response.dataLocation()); + Assertions.assertEquals("mwyhr", response.location()); + Assertions.assertEquals("yftaakcpw", response.tags().get("yzvqt")); + Assertions.assertEquals("odfvuefywsbp", response.dataLocation()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java index e5fd8be78eaa..31e344c49c2b 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java @@ -7,8 +7,8 @@ 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.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.EmailServiceResource; @@ -22,20 +22,20 @@ public final class EmailServicesListByResourceGroupMockTests { @Test public void testListByResourceGroup() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Updating\",\"dataLocation\":\"jzbexilzznfq\"},\"location\":\"vwpm\",\"tags\":{\"jhwqytjrybnw\":\"ruoujmk\",\"enq\":\"ewgdrjervn\",\"ndoygmifthnzdnd\":\"eh\",\"nayqi\":\"l\"},\"id\":\"ynduha\",\"name\":\"hqlkthumaqo\",\"type\":\"bgycduiertgccym\"}]}"; + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Moving\",\"dataLocation\":\"t\"},\"location\":\"vfbtkuwh\",\"tags\":{\"koymkcd\":\"ykojoxafnndlpic\",\"pkkpw\":\"h\",\"jxywsuws\":\"reqnovvqfov\",\"aeneqnzarrwl\":\"rsndsytgadgvra\"},\"id\":\"uu\",\"name\":\"jfqka\",\"type\":\"e\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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.emailServices().listByResourceGroup("t", com.azure.core.util.Context.NONE); + = manager.emailServices().listByResourceGroup("erpqlpqwcciuqg", com.azure.core.util.Context.NONE); - Assertions.assertEquals("vwpm", response.iterator().next().location()); - Assertions.assertEquals("ruoujmk", response.iterator().next().tags().get("jhwqytjrybnw")); - Assertions.assertEquals("jzbexilzznfq", response.iterator().next().dataLocation()); + Assertions.assertEquals("vfbtkuwh", response.iterator().next().location()); + Assertions.assertEquals("ykojoxafnndlpic", response.iterator().next().tags().get("koymkcd")); + Assertions.assertEquals("t", response.iterator().next().dataLocation()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java index ca12011cd3e9..312c1414353c 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java @@ -7,8 +7,8 @@ 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.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.EmailServiceResource; @@ -22,19 +22,19 @@ public final class EmailServicesListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Creating\",\"dataLocation\":\"vkr\"},\"location\":\"wbxqzvszjfau\",\"tags\":{\"tvtc\":\"dxxiv\",\"wvxysl\":\"aqtdoqmcbx\",\"ytkblmpew\":\"bhsfxob\",\"shqjohxcrsbf\":\"wfbkrvrns\"},\"id\":\"vasrruvwb\",\"name\":\"sqfsubcgjbirxb\",\"type\":\"ybsrfbjfdtwss\"}]}"; + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Deleting\",\"dataLocation\":\"ckcb\"},\"location\":\"ejrjxgciqibrho\",\"tags\":{\"rq\":\"dqrhzoymib\",\"dtmhrkwofyyvoqa\":\"ibahwflus\",\"wo\":\"piexpbtgiw\",\"kcnqxwbpo\":\"nwashrtd\"},\"id\":\"ulpiuj\",\"name\":\"aasipqi\",\"type\":\"obyu\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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.emailServices().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("wbxqzvszjfau", response.iterator().next().location()); - Assertions.assertEquals("dxxiv", response.iterator().next().tags().get("tvtc")); - Assertions.assertEquals("vkr", response.iterator().next().dataLocation()); + Assertions.assertEquals("ejrjxgciqibrho", response.iterator().next().location()); + Assertions.assertEquals("dqrhzoymib", response.iterator().next().tags().get("rq")); + Assertions.assertEquals("ckcb", response.iterator().next().dataLocation()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java index 2255ecfc3236..2d14fc6d2f83 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import java.nio.charset.StandardCharsets; @@ -20,19 +20,19 @@ public final class EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests { @Test public void testListVerifiedExchangeOnlineDomainsWithResponse() throws Exception { - String responseStr = "[\"olpsslqlf\",\"mdnbbglzpswiy\"]"; + String responseStr = "[\"ipfpubji\",\"wwiftohqkvpuv\"]"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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)); List response = manager.emailServices() .listVerifiedExchangeOnlineDomainsWithResponse(com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("olpsslqlf", response.get(0)); + Assertions.assertEquals("ipfpubji", response.get(0)); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java index 31eb9a3fcf5a..cecea80a9932 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java @@ -16,7 +16,7 @@ public final class ManagedServiceIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ManagedServiceIdentity model = BinaryData.fromString( - "{\"principalId\":\"19b9f969-8854-498f-88ff-063b57c350d7\",\"tenantId\":\"08daee90-d265-4508-813f-387632e0df12\",\"type\":\"None\",\"userAssignedIdentities\":{\"txilnerkujy\":{\"principalId\":\"84308e58-81d4-414f-9a57-81898c878fd6\",\"clientId\":\"d8b1e730-c0d1-4ddf-ac20-0f8a94bb6561\"},\"eju\":{\"principalId\":\"d895c76e-b4b7-4c41-bb22-c50fcf966062\",\"clientId\":\"7ba792c3-355b-4cde-8772-e5162c4e11de\"},\"awrlyx\":{\"principalId\":\"301d3a72-f4b5-437e-a774-d3af01e3fda8\",\"clientId\":\"1cee813d-a242-4b88-b2b6-c048350872bf\"},\"cpr\":{\"principalId\":\"b79f2bf5-8861-4014-a97f-14346b67299b\",\"clientId\":\"a2ecfb57-207a-4c90-bdc3-aa82d38e23f4\"}}}") + "{\"principalId\":\"e0bc99e3-3cda-4f74-9a0d-757be3e8574f\",\"tenantId\":\"f0cd7817-6658-49bb-b6ac-6e4f4f8923c2\",\"type\":\"None\",\"userAssignedIdentities\":{\"fqawrlyxw\":{\"principalId\":\"e3990390-9104-434b-920d-bca55c4e00ae\",\"clientId\":\"d3e0283c-589d-4ffe-92f7-1b8dbde542b9\"}}}") .toObject(ManagedServiceIdentity.class); Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.type()); } @@ -24,8 +24,7 @@ public void testDeserialize() throws Exception { @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) - .withUserAssignedIdentities(mapOf("txilnerkujy", new UserAssignedIdentity(), "eju", - new UserAssignedIdentity(), "awrlyx", new UserAssignedIdentity(), "cpr", new UserAssignedIdentity())); + .withUserAssignedIdentities(mapOf("fqawrlyxw", new UserAssignedIdentity())); model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.type()); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java index 9f9032b82486..3241bb2ddb20 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java @@ -7,8 +7,8 @@ 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.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.Operation; @@ -21,14 +21,14 @@ public final class OperationsListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"name\":\"qftiy\",\"isDataAction\":true,\"display\":{\"provider\":\"cqvyxlwhzlsico\",\"resource\":\"qqn\",\"operation\":\"lryav\",\"description\":\"heun\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + = "{\"value\":[{\"name\":\"vjtoqnermclfp\",\"isDataAction\":false,\"display\":{\"provider\":\"uscrpabgyepsb\",\"resource\":\"azqugxywpmueefj\",\"operation\":\"fqkquj\",\"description\":\"suyonobglaocq\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java index 65044c2ed395..72e21e9f90bc 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.SenderUsernameResource; @@ -21,23 +21,23 @@ public final class SenderUsernamesCreateOrUpdateWithResponseMockTests { @Test public void testCreateOrUpdateWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"dataLocation\":\"vqtmnub\",\"username\":\"xkp\",\"displayName\":\"smond\",\"provisioningState\":\"Creating\"},\"id\":\"xvy\",\"name\":\"omgkopkwho\",\"type\":\"v\"}"; + = "{\"properties\":{\"dataLocation\":\"ofwq\",\"username\":\"zqalkrmnjijpx\",\"displayName\":\"q\",\"provisioningState\":\"Succeeded\"},\"id\":\"nbyxbaaabjyv\",\"name\":\"yffimrzrtuzqogs\",\"type\":\"xnevfdnwn\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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)); SenderUsernameResource response = manager.senderUsernames() - .define("opcjwvnhd") - .withExistingDomain("cvkcvqvpkeqdcv", "rhvoods", "tbobz") - .withUsername("twuoegrpkhjwni") - .withDisplayName("sluicpdggkzz") + .define("dunyg") + .withExistingDomain("zikhl", "fjhdg", "gge") + .withUsername("fatpxllrxcyjmoa") + .withDisplayName("uvarmywdmjsjq") .create(); - Assertions.assertEquals("xkp", response.username()); - Assertions.assertEquals("smond", response.displayName()); + Assertions.assertEquals("zqalkrmnjijpx", response.username()); + Assertions.assertEquals("q", response.displayName()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java index eda8fdb613a3..c72067ff6a00 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import java.nio.charset.StandardCharsets; @@ -25,10 +25,10 @@ public void testDeleteWithResponse() throws Exception { CommunicationManager manager = CommunicationManager.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)); manager.senderUsernames() - .deleteWithResponse("lxyjr", "sag", "fcnihgwq", "pnedgf", com.azure.core.util.Context.NONE); + .deleteWithResponse("jrvxaglrv", "mjwosytx", "tcs", "fcktqumiekke", com.azure.core.util.Context.NONE); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java index 1c4036c7fa64..6ef1640f4df9 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java @@ -6,8 +6,8 @@ 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.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.SenderUsernameResource; @@ -21,20 +21,20 @@ public final class SenderUsernamesGetWithResponseMockTests { @Test public void testGetWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"dataLocation\":\"hfwdsjnkaljutiis\",\"username\":\"acffgdkzzewkfvhq\",\"displayName\":\"a\",\"provisioningState\":\"Updating\"},\"id\":\"n\",\"name\":\"pfuflrw\",\"type\":\"mh\"}"; + = "{\"properties\":{\"dataLocation\":\"yfkzik\",\"username\":\"jawneaiv\",\"displayName\":\"czelpcirel\",\"provisioningState\":\"Creating\"},\"id\":\"enwabfatk\",\"name\":\"ddxbjhwuaanoz\",\"type\":\"osphyoul\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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)); SenderUsernameResource response = manager.senderUsernames() - .getWithResponse("quuvxzxcl", "ithhqzon", "sg", "b", com.azure.core.util.Context.NONE) + .getWithResponse("himdbl", "gwimfn", "hfjx", "mszkkfo", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("acffgdkzzewkfvhq", response.username()); - Assertions.assertEquals("a", response.displayName()); + Assertions.assertEquals("jawneaiv", response.username()); + Assertions.assertEquals("czelpcirel", response.displayName()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java index ee65618cbb75..8b557bc43814 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java @@ -7,8 +7,8 @@ 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.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.SenderUsernameResource; @@ -22,19 +22,19 @@ public final class SenderUsernamesListByDomainsMockTests { @Test public void testListByDomains() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"dataLocation\":\"tmuwlauwzi\",\"username\":\"xbmp\",\"displayName\":\"jefuzmuvpbttdumo\",\"provisioningState\":\"Succeeded\"},\"id\":\"ebmnzbtbhjpglk\",\"name\":\"gohdneuelfphsd\",\"type\":\"htozfikdow\"}]}"; + = "{\"value\":[{\"properties\":{\"dataLocation\":\"v\",\"username\":\"tkwqqtchealm\",\"displayName\":\"tdaaygdvwvg\",\"provisioningState\":\"Running\"},\"id\":\"g\",\"name\":\"xrtfudxep\",\"type\":\"gyqagvrvmnpkuk\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); CommunicationManager manager = CommunicationManager.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.senderUsernames() - .listByDomains("ebxmubyynt", "lrb", "tkoievseotgq", com.azure.core.util.Context.NONE); + PagedIterable response + = manager.senderUsernames().listByDomains("v", "vvcnayr", "yrnxxmueedn", com.azure.core.util.Context.NONE); - Assertions.assertEquals("xbmp", response.iterator().next().username()); - Assertions.assertEquals("jefuzmuvpbttdumo", response.iterator().next().displayName()); + Assertions.assertEquals("tkwqqtchealm", response.iterator().next().username()); + Assertions.assertEquals("tdaaygdvwvg", response.iterator().next().displayName()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamePropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamePropertiesTests.java new file mode 100644 index 000000000000..94d0b279b645 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamePropertiesTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.fluent.models.SmtpUsernameProperties; +import org.junit.jupiter.api.Assertions; + +public final class SmtpUsernamePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SmtpUsernameProperties model = BinaryData + .fromString( + "{\"username\":\"sncghkjeszz\",\"entraApplicationId\":\"bijhtxfvgxbf\",\"tenantId\":\"mxnehmp\"}") + .toObject(SmtpUsernameProperties.class); + Assertions.assertEquals("sncghkjeszz", model.username()); + Assertions.assertEquals("bijhtxfvgxbf", model.entraApplicationId()); + Assertions.assertEquals("mxnehmp", model.tenantId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SmtpUsernameProperties model = new SmtpUsernameProperties().withUsername("sncghkjeszz") + .withEntraApplicationId("bijhtxfvgxbf") + .withTenantId("mxnehmp"); + model = BinaryData.fromObject(model).toObject(SmtpUsernameProperties.class); + Assertions.assertEquals("sncghkjeszz", model.username()); + Assertions.assertEquals("bijhtxfvgxbf", model.entraApplicationId()); + Assertions.assertEquals("mxnehmp", model.tenantId()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernameResourceCollectionTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernameResourceCollectionTests.java new file mode 100644 index 000000000000..35e19b1c314f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernameResourceCollectionTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.fluent.models.SmtpUsernameResourceInner; +import com.azure.resourcemanager.communication.models.SmtpUsernameResourceCollection; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SmtpUsernameResourceCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SmtpUsernameResourceCollection model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"username\":\"tiyqzrnkcqv\",\"entraApplicationId\":\"xlwhzlsicoh\",\"tenantId\":\"qqn\"},\"id\":\"lryav\",\"name\":\"hheunmmqhgyx\",\"type\":\"konocu\"},{\"properties\":{\"username\":\"klyaxuconu\",\"entraApplicationId\":\"szfkbe\",\"tenantId\":\"pewr\"},\"id\":\"mwvvjektcxsenhw\",\"name\":\"rsffrzpwvlqdqgbi\",\"type\":\"ylihkaetckt\"}],\"nextLink\":\"civfsnkymuctq\"}") + .toObject(SmtpUsernameResourceCollection.class); + Assertions.assertEquals("tiyqzrnkcqv", model.value().get(0).username()); + Assertions.assertEquals("xlwhzlsicoh", model.value().get(0).entraApplicationId()); + Assertions.assertEquals("qqn", model.value().get(0).tenantId()); + Assertions.assertEquals("civfsnkymuctq", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SmtpUsernameResourceCollection model = new SmtpUsernameResourceCollection().withValue(Arrays.asList( + new SmtpUsernameResourceInner().withUsername("tiyqzrnkcqv") + .withEntraApplicationId("xlwhzlsicoh") + .withTenantId("qqn"), + new SmtpUsernameResourceInner().withUsername("klyaxuconu") + .withEntraApplicationId("szfkbe") + .withTenantId("pewr"))) + .withNextLink("civfsnkymuctq"); + model = BinaryData.fromObject(model).toObject(SmtpUsernameResourceCollection.class); + Assertions.assertEquals("tiyqzrnkcqv", model.value().get(0).username()); + Assertions.assertEquals("xlwhzlsicoh", model.value().get(0).entraApplicationId()); + Assertions.assertEquals("qqn", model.value().get(0).tenantId()); + Assertions.assertEquals("civfsnkymuctq", model.nextLink()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernameResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernameResourceInnerTests.java new file mode 100644 index 000000000000..ef95c0c43f6a --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernameResourceInnerTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.fluent.models.SmtpUsernameResourceInner; +import org.junit.jupiter.api.Assertions; + +public final class SmtpUsernameResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SmtpUsernameResourceInner model = BinaryData.fromString( + "{\"properties\":{\"username\":\"fbebrjcxer\",\"entraApplicationId\":\"uwutttxfvjrbi\",\"tenantId\":\"phxepcyvahf\"},\"id\":\"jky\",\"name\":\"xjvuujqgidokg\",\"type\":\"ljyoxgvcltb\"}") + .toObject(SmtpUsernameResourceInner.class); + Assertions.assertEquals("fbebrjcxer", model.username()); + Assertions.assertEquals("uwutttxfvjrbi", model.entraApplicationId()); + Assertions.assertEquals("phxepcyvahf", model.tenantId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SmtpUsernameResourceInner model = new SmtpUsernameResourceInner().withUsername("fbebrjcxer") + .withEntraApplicationId("uwutttxfvjrbi") + .withTenantId("phxepcyvahf"); + model = BinaryData.fromObject(model).toObject(SmtpUsernameResourceInner.class); + Assertions.assertEquals("fbebrjcxer", model.username()); + Assertions.assertEquals("uwutttxfvjrbi", model.entraApplicationId()); + Assertions.assertEquals("phxepcyvahf", model.tenantId()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesCreateOrUpdateWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..c2420caf176f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import com.azure.resourcemanager.communication.models.SmtpUsernameResource; +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 SmtpUsernamesCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"username\":\"ca\",\"entraApplicationId\":\"vxb\",\"tenantId\":\"t\"},\"id\":\"dut\",\"name\":\"cormr\",\"type\":\"xqtvcofu\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SmtpUsernameResource response = manager.smtpUsernames() + .define("rbuukzclewyhmlwp") + .withExistingCommunicationService("v", "jjxd") + .withUsername("tzpofncckwyfzq") + .withEntraApplicationId("hxx") + .withTenantId("uyqaxzfeqztppr") + .create(); + + Assertions.assertEquals("ca", response.username()); + Assertions.assertEquals("vxb", response.entraApplicationId()); + Assertions.assertEquals("t", response.tenantId()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesDeleteWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..b81996571cda --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesDeleteWithResponseMockTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SmtpUsernamesDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.smtpUsernames() + .deleteWithResponse("qjnsjervtia", "xsdszuempsb", "kfzbeyvpnqicvi", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesGetWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesGetWithResponseMockTests.java new file mode 100644 index 000000000000..389b1a7afbcc --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesGetWithResponseMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import com.azure.resourcemanager.communication.models.SmtpUsernameResource; +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 SmtpUsernamesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"username\":\"dooaojkniodko\",\"entraApplicationId\":\"ebwnujhe\",\"tenantId\":\"msbvdkcrodtjinf\"},\"id\":\"lfltka\",\"name\":\"jvefkdlfoakggkfp\",\"type\":\"gaowpulpqblylsyx\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SmtpUsernameResource response = manager.smtpUsernames() + .getWithResponse("uyfxrxxleptramxj", "zwl", "nwxuqlcvydyp", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dooaojkniodko", response.username()); + Assertions.assertEquals("ebwnujhe", response.entraApplicationId()); + Assertions.assertEquals("msbvdkcrodtjinf", response.tenantId()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesListMockTests.java new file mode 100644 index 000000000000..c2fa4e4a9f2c --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesListMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import com.azure.resourcemanager.communication.models.SmtpUsernameResource; +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 SmtpUsernamesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"username\":\"ud\",\"entraApplicationId\":\"frxtrthzvaytdwk\",\"tenantId\":\"brqubp\"},\"id\":\"h\",\"name\":\"xiilivpdtiirqt\",\"type\":\"qoaxoruzfgs\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.smtpUsernames().list("mewzsyyc", "uzsoi", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ud", response.iterator().next().username()); + Assertions.assertEquals("frxtrthzvaytdwk", response.iterator().next().entraApplicationId()); + Assertions.assertEquals("brqubp", response.iterator().next().tenantId()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressPropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressPropertiesTests.java new file mode 100644 index 000000000000..91a3dc095d58 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListAddressProperties; +import org.junit.jupiter.api.Assertions; + +public final class SuppressionListAddressPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SuppressionListAddressProperties model = BinaryData.fromString( + "{\"email\":\"o\",\"firstName\":\"ilovnot\",\"lastName\":\"jfcn\",\"notes\":\"k\",\"lastModified\":\"2021-03-04T17:11:57Z\",\"dataLocation\":\"hbttkphyw\"}") + .toObject(SuppressionListAddressProperties.class); + Assertions.assertEquals("o", model.email()); + Assertions.assertEquals("ilovnot", model.firstName()); + Assertions.assertEquals("jfcn", model.lastName()); + Assertions.assertEquals("k", model.notes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SuppressionListAddressProperties model = new SuppressionListAddressProperties().withEmail("o") + .withFirstName("ilovnot") + .withLastName("jfcn") + .withNotes("k"); + model = BinaryData.fromObject(model).toObject(SuppressionListAddressProperties.class); + Assertions.assertEquals("o", model.email()); + Assertions.assertEquals("ilovnot", model.firstName()); + Assertions.assertEquals("jfcn", model.lastName()); + Assertions.assertEquals("k", model.notes()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressResourceCollectionTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressResourceCollectionTests.java new file mode 100644 index 000000000000..16a63b0881a1 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressResourceCollectionTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListAddressResourceInner; +import com.azure.resourcemanager.communication.models.SuppressionListAddressResourceCollection; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SuppressionListAddressResourceCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SuppressionListAddressResourceCollection model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"email\":\"hxw\",\"firstName\":\"tyq\",\"lastName\":\"lbbovplw\",\"notes\":\"hvgyuguosvmk\",\"lastModified\":\"2021-11-15T07:00:08Z\",\"dataLocation\":\"qukkfp\"},\"id\":\"mg\",\"name\":\"xnkjzkdesl\",\"type\":\"vlopwiyighx\"}],\"nextLink\":\"dwzbaiue\"}") + .toObject(SuppressionListAddressResourceCollection.class); + Assertions.assertEquals("hxw", model.value().get(0).email()); + Assertions.assertEquals("tyq", model.value().get(0).firstName()); + Assertions.assertEquals("lbbovplw", model.value().get(0).lastName()); + Assertions.assertEquals("hvgyuguosvmk", model.value().get(0).notes()); + Assertions.assertEquals("dwzbaiue", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SuppressionListAddressResourceCollection model = new SuppressionListAddressResourceCollection() + .withValue(Arrays.asList(new SuppressionListAddressResourceInner().withEmail("hxw") + .withFirstName("tyq") + .withLastName("lbbovplw") + .withNotes("hvgyuguosvmk"))) + .withNextLink("dwzbaiue"); + model = BinaryData.fromObject(model).toObject(SuppressionListAddressResourceCollection.class); + Assertions.assertEquals("hxw", model.value().get(0).email()); + Assertions.assertEquals("tyq", model.value().get(0).firstName()); + Assertions.assertEquals("lbbovplw", model.value().get(0).lastName()); + Assertions.assertEquals("hvgyuguosvmk", model.value().get(0).notes()); + Assertions.assertEquals("dwzbaiue", model.nextLink()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressResourceInnerTests.java new file mode 100644 index 000000000000..3c20b7c101b7 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressResourceInnerTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListAddressResourceInner; +import org.junit.jupiter.api.Assertions; + +public final class SuppressionListAddressResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SuppressionListAddressResourceInner model = BinaryData.fromString( + "{\"properties\":{\"email\":\"a\",\"firstName\":\"nyqupedeojnabck\",\"lastName\":\"mtxpsiebtfh\",\"notes\":\"esap\",\"lastModified\":\"2021-05-25T03:50:38Z\",\"dataLocation\":\"qmhjjdhtld\"},\"id\":\"yzxuutkncw\",\"name\":\"cwsvlxotog\",\"type\":\"wrupqsxvnmicykvc\"}") + .toObject(SuppressionListAddressResourceInner.class); + Assertions.assertEquals("a", model.email()); + Assertions.assertEquals("nyqupedeojnabck", model.firstName()); + Assertions.assertEquals("mtxpsiebtfh", model.lastName()); + Assertions.assertEquals("esap", model.notes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SuppressionListAddressResourceInner model = new SuppressionListAddressResourceInner().withEmail("a") + .withFirstName("nyqupedeojnabck") + .withLastName("mtxpsiebtfh") + .withNotes("esap"); + model = BinaryData.fromObject(model).toObject(SuppressionListAddressResourceInner.class); + Assertions.assertEquals("a", model.email()); + Assertions.assertEquals("nyqupedeojnabck", model.firstName()); + Assertions.assertEquals("mtxpsiebtfh", model.lastName()); + Assertions.assertEquals("esap", model.notes()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesCreateOrUpdateWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..53ddbe3c4c4d --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import com.azure.resourcemanager.communication.models.SuppressionListAddressResource; +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 SuppressionListAddressesCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"email\":\"t\",\"firstName\":\"ib\",\"lastName\":\"cgpik\",\"notes\":\"imejzanl\",\"lastModified\":\"2021-04-29T09:22:09Z\",\"dataLocation\":\"av\"},\"id\":\"bzonok\",\"name\":\"xrjqcirgzpfrlazs\",\"type\":\"rnwoiindfp\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SuppressionListAddressResource response = manager.suppressionListAddresses() + .define("bizikayuhq") + .withExistingSuppressionList("vncjabudurgk", "kmokz", "jjklff", "mouwqlgzrfzeey") + .withEmail("jbsybbqw") + .withFirstName("t") + .withLastName("gmfpgvmp") + .withNotes("as") + .create(); + + Assertions.assertEquals("t", response.email()); + Assertions.assertEquals("ib", response.firstName()); + Assertions.assertEquals("cgpik", response.lastName()); + Assertions.assertEquals("imejzanl", response.notes()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesDeleteWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..6d83e584f153 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesDeleteWithResponseMockTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SuppressionListAddressesDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.suppressionListAddresses() + .deleteWithResponse("rwkq", "yhgbijtjivfx", "sjabibs", "stawfsdjpvkv", "bjxbkzbzk", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesGetWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesGetWithResponseMockTests.java new file mode 100644 index 000000000000..11f80e89e6da --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesGetWithResponseMockTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import com.azure.resourcemanager.communication.models.SuppressionListAddressResource; +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 SuppressionListAddressesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"email\":\"ltiugcxnavv\",\"firstName\":\"qiby\",\"lastName\":\"nyowxwlmdjrkvfg\",\"notes\":\"fvpdbo\",\"lastModified\":\"2021-12-02T21:38:46Z\",\"dataLocation\":\"zsjqlh\"},\"id\":\"r\",\"name\":\"bdeibqipqk\",\"type\":\"hvxndzwmkrefajpj\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SuppressionListAddressResource response = manager.suppressionListAddresses() + .getWithResponse("ujzra", "htwdwrftswibyrcd", "bhshfwpracstwity", "hevxcced", "pnmdyodnwzxltjcv", + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ltiugcxnavv", response.email()); + Assertions.assertEquals("qiby", response.firstName()); + Assertions.assertEquals("nyowxwlmdjrkvfg", response.lastName()); + Assertions.assertEquals("fvpdbo", response.notes()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesListMockTests.java new file mode 100644 index 000000000000..e362dd3ddc06 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesListMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import com.azure.resourcemanager.communication.models.SuppressionListAddressResource; +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 SuppressionListAddressesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"email\":\"gicccnxqhuex\",\"firstName\":\"ttlstvlzywemhz\",\"lastName\":\"csdtclusiypbs\",\"notes\":\"ytguslf\",\"lastModified\":\"2021-10-02T12:36:06Z\",\"dataLocation\":\"ygqukyhejh\"},\"id\":\"sx\",\"name\":\"fpel\",\"type\":\"lppvksrpq\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.suppressionListAddresses() + .list("zbwemh", "i", "sbrgz", "wmsweypqwd", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("gicccnxqhuex", response.iterator().next().email()); + Assertions.assertEquals("ttlstvlzywemhz", response.iterator().next().firstName()); + Assertions.assertEquals("csdtclusiypbs", response.iterator().next().lastName()); + Assertions.assertEquals("ytguslf", response.iterator().next().notes()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListPropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListPropertiesTests.java new file mode 100644 index 000000000000..15da8176b599 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListProperties; +import org.junit.jupiter.api.Assertions; + +public final class SuppressionListPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SuppressionListProperties model = BinaryData.fromString( + "{\"listName\":\"d\",\"lastUpdatedTimeStamp\":\"avxbniwdjswztsdb\",\"createdTimeStamp\":\"nxytxh\",\"dataLocation\":\"xbzpfzab\"}") + .toObject(SuppressionListProperties.class); + Assertions.assertEquals("d", model.listName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SuppressionListProperties model = new SuppressionListProperties().withListName("d"); + model = BinaryData.fromObject(model).toObject(SuppressionListProperties.class); + Assertions.assertEquals("d", model.listName()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListResourceCollectionTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListResourceCollectionTests.java new file mode 100644 index 000000000000..1c061efa744e --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListResourceCollectionTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListResourceInner; +import com.azure.resourcemanager.communication.models.SuppressionListResourceCollection; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SuppressionListResourceCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SuppressionListResourceCollection model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"listName\":\"odebfqkkrbmpu\",\"lastUpdatedTimeStamp\":\"riwflzlfb\",\"createdTimeStamp\":\"puz\",\"dataLocation\":\"ispnqzahmgkbrp\"},\"id\":\"dhibnuq\",\"name\":\"kpikadrgvt\",\"type\":\"agnb\"},{\"properties\":{\"listName\":\"hijggme\",\"lastUpdatedTimeStamp\":\"siarbutrcvpn\",\"createdTimeStamp\":\"zmhjrunmp\",\"dataLocation\":\"tdbhrbnla\"},\"id\":\"xmyskp\",\"name\":\"henbtkcxywnytn\",\"type\":\"synlqidybyxczfc\"}],\"nextLink\":\"aaxdbabphlwrq\"}") + .toObject(SuppressionListResourceCollection.class); + Assertions.assertEquals("odebfqkkrbmpu", model.value().get(0).listName()); + Assertions.assertEquals("aaxdbabphlwrq", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SuppressionListResourceCollection model = new SuppressionListResourceCollection() + .withValue(Arrays.asList(new SuppressionListResourceInner().withListName("odebfqkkrbmpu"), + new SuppressionListResourceInner().withListName("hijggme"))) + .withNextLink("aaxdbabphlwrq"); + model = BinaryData.fromObject(model).toObject(SuppressionListResourceCollection.class); + Assertions.assertEquals("odebfqkkrbmpu", model.value().get(0).listName()); + Assertions.assertEquals("aaxdbabphlwrq", model.nextLink()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListResourceInnerTests.java new file mode 100644 index 000000000000..16e85ebc8b6e --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListResourceInnerTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.fluent.models.SuppressionListResourceInner; +import org.junit.jupiter.api.Assertions; + +public final class SuppressionListResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SuppressionListResourceInner model = BinaryData.fromString( + "{\"properties\":{\"listName\":\"tsthsucocm\",\"lastUpdatedTimeStamp\":\"yazttbtwwrqpue\",\"createdTimeStamp\":\"kzywbiex\",\"dataLocation\":\"eyueaxibxujwb\"},\"id\":\"walm\",\"name\":\"zyoxaepdkzjan\",\"type\":\"ux\"}") + .toObject(SuppressionListResourceInner.class); + Assertions.assertEquals("tsthsucocm", model.listName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SuppressionListResourceInner model = new SuppressionListResourceInner().withListName("tsthsucocm"); + model = BinaryData.fromObject(model).toObject(SuppressionListResourceInner.class); + Assertions.assertEquals("tsthsucocm", model.listName()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsCreateOrUpdateWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..c4c5d0888280 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import com.azure.resourcemanager.communication.models.SuppressionListResource; +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 SuppressionListsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"listName\":\"zqhof\",\"lastUpdatedTimeStamp\":\"maequiahxicslfa\",\"createdTimeStamp\":\"z\",\"dataLocation\":\"yylhalnswhccsp\"},\"id\":\"aivwitqscywu\",\"name\":\"gwol\",\"type\":\"h\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SuppressionListResource response = manager.suppressionLists() + .define("wpusdsttwvogv") + .withExistingDomain("fhpagmhrskdsnf", "sd", "akgtdlmkkzevdlh") + .withListName("jdcngqqm") + .create(); + + Assertions.assertEquals("zqhof", response.listName()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsDeleteWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..8dc63605fddf --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsDeleteWithResponseMockTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SuppressionListsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.suppressionLists() + .deleteWithResponse("vbtqgsfraoyzk", "owtlmnguxawqald", "yuuximerqfobwyzn", "bykutw", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsGetWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsGetWithResponseMockTests.java new file mode 100644 index 000000000000..324fc9d62da2 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsGetWithResponseMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import com.azure.resourcemanager.communication.models.SuppressionListResource; +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 SuppressionListsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"listName\":\"oqouicybxarzgszu\",\"lastUpdatedTimeStamp\":\"x\",\"createdTimeStamp\":\"q\",\"dataLocation\":\"idoamciodhkha\"},\"id\":\"khnzbonlw\",\"name\":\"toego\",\"type\":\"dwbwhkszzcmrvexz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SuppressionListResource response = manager.suppressionLists() + .getWithResponse("gkfbtndoaong", "jcntuj", "tcje", "ftwwaezkojvdc", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("oqouicybxarzgszu", response.listName()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsListByDomainMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsListByDomainMockTests.java new file mode 100644 index 000000000000..7c307afd75f8 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SuppressionListsListByDomainMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.communication.CommunicationManager; +import com.azure.resourcemanager.communication.models.SuppressionListResource; +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 SuppressionListsListByDomainMockTests { + @Test + public void testListByDomain() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"listName\":\"knnqvsaznq\",\"lastUpdatedTimeStamp\":\"orudsgsa\",\"createdTimeStamp\":\"kycgrauwj\",\"dataLocation\":\"taeburuvdm\"},\"id\":\"s\",\"name\":\"zlxwabmqoefkifr\",\"type\":\"tpuqujmq\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommunicationManager manager = CommunicationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.suppressionLists().listByDomain("f", "vkg", "u", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("knnqvsaznq", response.iterator().next().listName()); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java index 7a3e5f7a7a91..5090700a0ff2 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java @@ -13,16 +13,19 @@ public final class TaggedResourceTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - TaggedResource model = BinaryData.fromString("{\"tags\":{\"pymzidnsezcxtbzs\":\"mijcmmxdcufufs\"}}") + TaggedResource model = BinaryData + .fromString( + "{\"tags\":{\"aop\":\"kfthwxmntei\",\"jcmmxdcufufsrp\":\"km\",\"sgfyccsnew\":\"mzidnsezcxtb\"}}") .toObject(TaggedResource.class); - Assertions.assertEquals("mijcmmxdcufufs", model.tags().get("pymzidnsezcxtbzs")); + Assertions.assertEquals("kfthwxmntei", model.tags().get("aop")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - TaggedResource model = new TaggedResource().withTags(mapOf("pymzidnsezcxtbzs", "mijcmmxdcufufs")); + TaggedResource model = new TaggedResource() + .withTags(mapOf("aop", "kfthwxmntei", "jcmmxdcufufsrp", "km", "sgfyccsnew", "mzidnsezcxtb")); model = BinaryData.fromObject(model).toObject(TaggedResource.class); - Assertions.assertEquals("mijcmmxdcufufs", model.tags().get("pymzidnsezcxtbzs")); + Assertions.assertEquals("kfthwxmntei", model.tags().get("aop")); } // Use "Map.of" if available diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java index 75359263d29d..905aa8fb56c5 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java @@ -13,15 +13,15 @@ public final class UpdateDomainPropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { UpdateDomainProperties model - = BinaryData.fromString("{\"userEngagementTracking\":\"Enabled\"}").toObject(UpdateDomainProperties.class); - Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); + = BinaryData.fromString("{\"userEngagementTracking\":\"Disabled\"}").toObject(UpdateDomainProperties.class); + Assertions.assertEquals(UserEngagementTracking.DISABLED, model.userEngagementTracking()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { UpdateDomainProperties model - = new UpdateDomainProperties().withUserEngagementTracking(UserEngagementTracking.ENABLED); + = new UpdateDomainProperties().withUserEngagementTracking(UserEngagementTracking.DISABLED); model = BinaryData.fromObject(model).toObject(UpdateDomainProperties.class); - Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); + Assertions.assertEquals(UserEngagementTracking.DISABLED, model.userEngagementTracking()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java index d344abfdb83b..6c3982584500 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java @@ -16,19 +16,19 @@ public final class UpdateDomainRequestParametersTests { public void testDeserialize() throws Exception { UpdateDomainRequestParameters model = BinaryData .fromString( - "{\"properties\":{\"userEngagementTracking\":\"Enabled\"},\"tags\":{\"zxibqeoj\":\"ocjjxhvpmouexh\"}}") + "{\"properties\":{\"userEngagementTracking\":\"Enabled\"},\"tags\":{\"uhrhcffcyddgl\":\"npzaoq\"}}") .toObject(UpdateDomainRequestParameters.class); - Assertions.assertEquals("ocjjxhvpmouexh", model.tags().get("zxibqeoj")); + Assertions.assertEquals("npzaoq", model.tags().get("uhrhcffcyddgl")); Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { UpdateDomainRequestParameters model - = new UpdateDomainRequestParameters().withTags(mapOf("zxibqeoj", "ocjjxhvpmouexh")) + = new UpdateDomainRequestParameters().withTags(mapOf("uhrhcffcyddgl", "npzaoq")) .withUserEngagementTracking(UserEngagementTracking.ENABLED); model = BinaryData.fromObject(model).toObject(UpdateDomainRequestParameters.class); - Assertions.assertEquals("ocjjxhvpmouexh", model.tags().get("zxibqeoj")); + Assertions.assertEquals("npzaoq", model.tags().get("uhrhcffcyddgl")); Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java index 93967146b85e..6a5bfd07f835 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java @@ -11,7 +11,7 @@ public final class UserAssignedIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { UserAssignedIdentity model = BinaryData.fromString( - "{\"principalId\":\"632ab1bf-45db-4df1-84fe-f5981607ca80\",\"clientId\":\"6b72f0bd-e503-4885-b8a5-a69c358d0389\"}") + "{\"principalId\":\"20b035ba-109a-4fa4-b168-10b9d573a082\",\"clientId\":\"7962e970-90de-4bde-b00a-c854070bf464\"}") .toObject(UserAssignedIdentity.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java index 0aae65cc0da4..902fbb579106 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java @@ -13,14 +13,14 @@ public final class VerificationParameterTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { VerificationParameter model - = BinaryData.fromString("{\"verificationType\":\"DKIM\"}").toObject(VerificationParameter.class); - Assertions.assertEquals(VerificationType.DKIM, model.verificationType()); + = BinaryData.fromString("{\"verificationType\":\"DMARC\"}").toObject(VerificationParameter.class); + Assertions.assertEquals(VerificationType.DMARC, model.verificationType()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - VerificationParameter model = new VerificationParameter().withVerificationType(VerificationType.DKIM); + VerificationParameter model = new VerificationParameter().withVerificationType(VerificationType.DMARC); model = BinaryData.fromObject(model).toObject(VerificationParameter.class); - Assertions.assertEquals(VerificationType.DKIM, model.verificationType()); + Assertions.assertEquals(VerificationType.DMARC, model.verificationType()); } }