From cb9588fabe292930b58b42abd9e32ced12e37d36 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Feb 2025 16:46:00 +0000 Subject: [PATCH] CodeGen from PR 31971 in Azure/azure-rest-api-specs Merge 4f070d585c6d8cbab0883dd2add7f97dbfaff79b into 8cffc00ed31c6dee665bac9b638a01df75e4dd0b --- .../CHANGELOG.md | 52 +- .../README.md | 4 +- .../SAMPLE.md | 455 +++++++-- .../pom.xml | 3 +- .../communication/CommunicationManager.java | 51 +- .../CommunicationServiceManagementClient.java | 21 + .../fluent/SmtpUsernamesClient.java | 153 +++ .../SuppressionListAddressesClient.java | 174 ++++ .../fluent/SuppressionListsClient.java | 167 ++++ .../fluent/models/SmtpUsernameProperties.java | 172 ++++ .../models/SmtpUsernameResourceInner.java | 224 +++++ .../SuppressionListAddressProperties.java | 224 +++++ .../SuppressionListAddressResourceInner.java | 268 ++++++ .../models/SuppressionListProperties.java | 146 +++ .../models/SuppressionListResourceInner.java | 208 ++++ ...municationServiceManagementClientImpl.java | 50 +- .../SmtpUsernameResourceImpl.java | 158 +++ .../SmtpUsernamesClientImpl.java | 777 +++++++++++++++ .../implementation/SmtpUsernamesImpl.java | 162 ++++ .../SuppressionListAddressResourceImpl.java | 184 ++++ .../SuppressionListAddressesClientImpl.java | 896 ++++++++++++++++++ .../SuppressionListAddressesImpl.java | 214 +++++ .../SuppressionListResourceImpl.java | 155 +++ .../SuppressionListsClientImpl.java | 852 +++++++++++++++++ .../implementation/SuppressionListsImpl.java | 186 ++++ .../models/SmtpUsernameResource.java | 257 +++++ .../SmtpUsernameResourceCollection.java | 129 +++ .../communication/models/SmtpUsernames.java | 168 ++++ .../SuppressionListAddressResource.java | 311 ++++++ ...pressionListAddressResourceCollection.java | 130 +++ .../models/SuppressionListAddresses.java | 183 ++++ .../models/SuppressionListResource.java | 217 +++++ .../SuppressionListResourceCollection.java | 129 +++ .../models/SuppressionLists.java | 178 ++++ .../proxy-config.json | 2 +- ...nServicesCheckNameAvailabilitySamples.java | 4 +- ...nicationServicesCreateOrUpdateSamples.java | 4 +- .../CommunicationServicesDeleteSamples.java | 2 +- ...tionServicesGetByResourceGroupSamples.java | 2 +- ...ionServicesLinkNotificationHubSamples.java | 2 +- ...ionServicesListByResourceGroupSamples.java | 2 +- .../CommunicationServicesListKeysSamples.java | 2 +- .../CommunicationServicesListSamples.java | 2 +- ...unicationServicesRegenerateKeySamples.java | 2 +- .../CommunicationServicesUpdateSamples.java | 20 +- .../DomainsCancelVerificationSamples.java | 2 +- .../DomainsCreateOrUpdateSamples.java | 2 +- .../generated/DomainsDeleteSamples.java | 4 +- .../generated/DomainsGetSamples.java | 3 +- .../DomainsInitiateVerificationSamples.java | 2 +- ...ainsListByEmailServiceResourceSamples.java | 2 +- .../generated/DomainsUpdateSamples.java | 4 +- .../EmailServicesCreateOrUpdateSamples.java | 4 +- .../generated/EmailServicesDeleteSamples.java | 4 +- ...mailServicesGetByResourceGroupSamples.java | 4 +- ...ailServicesListByResourceGroupSamples.java | 4 +- .../generated/EmailServicesListSamples.java | 4 +- ...tVerifiedExchangeOnlineDomainsSamples.java | 4 +- .../generated/EmailServicesUpdateSamples.java | 4 +- .../generated/OperationsListSamples.java | 2 +- .../SenderUsernamesCreateOrUpdateSamples.java | 4 +- .../SenderUsernamesDeleteSamples.java | 4 +- .../generated/SenderUsernamesGetSamples.java | 4 +- .../SenderUsernamesListByDomainsSamples.java | 8 +- .../SmtpUsernamesCreateOrUpdateSamples.java | 33 + .../generated/SmtpUsernamesDeleteSamples.java | 27 + .../generated/SmtpUsernamesGetSamples.java | 26 + .../generated/SmtpUsernamesListSamples.java | 25 + ...ionListAddressesCreateOrUpdateSamples.java | 31 + ...SuppressionListAddressesDeleteSamples.java | 28 + .../SuppressionListAddressesGetSamples.java | 28 + .../SuppressionListAddressesListSamples.java | 27 + ...SuppressionListsCreateOrUpdateSamples.java | 29 + .../SuppressionListsDeleteSamples.java | 27 + .../generated/SuppressionListsGetSamples.java | 27 + .../SuppressionListsListByDomainSamples.java | 27 + .../CheckNameAvailabilityRequestTests.java | 28 - ...eckNameAvailabilityResponseInnerTests.java | 33 - .../CommunicationServicePropertiesTests.java | 30 - ...ommunicationServiceResourceInnerTests.java | 58 -- ...CommunicationServiceResourceListTests.java | 75 -- ...mmunicationServiceResourceUpdateTests.java | 52 - ...unicationServiceUpdatePropertiesTests.java | 28 - ...NameAvailabilityWithResponseMockTests.java | 44 - ...cationServicesCreateOrUpdateMockTests.java | 69 -- .../CommunicationServicesDeleteMockTests.java | 33 - ...tByResourceGroupWithResponseMockTests.java | 44 - ...kNotificationHubWithResponseMockTests.java | 43 - ...nServicesListByResourceGroupMockTests.java | 44 - .../CommunicationServicesListMockTests.java | 44 - .../generated/DnsRecordTests.java | 23 - ...ainPropertiesVerificationRecordsTests.java | 29 - .../generated/DomainsDeleteMockTests.java | 33 - .../EmailServicePropertiesTests.java | 26 - .../EmailServiceResourceInnerTests.java | 46 - .../EmailServiceResourceListTests.java | 62 -- .../EmailServiceResourceUpdateTests.java | 41 - .../EmailServicesCreateOrUpdateMockTests.java | 59 -- .../EmailServicesDeleteMockTests.java | 33 - ...tByResourceGroupWithResponseMockTests.java | 41 - ...lServicesListByResourceGroupMockTests.java | 41 - .../generated/EmailServicesListMockTests.java | 40 - ...ngeOnlineDomainsWithResponseMockTests.java | 38 - .../LinkNotificationHubParametersTests.java | 29 - .../LinkedNotificationHubInnerTests.java | 25 - .../ManagedServiceIdentityTests.java | 44 - .../NameAvailabilityParametersTests.java | 27 - .../generated/OperationDisplayTests.java | 23 - .../generated/OperationInnerTests.java | 24 - .../generated/OperationListResultTests.java | 23 - .../generated/OperationsListMockTests.java | 36 - .../SenderUsernamePropertiesTests.java | 28 - ...SenderUsernameResourceCollectionTests.java | 38 - .../SenderUsernameResourceInnerTests.java | 29 - ...esCreateOrUpdateWithResponseMockTests.java | 43 - ...rUsernamesDeleteWithResponseMockTests.java | 34 - ...nderUsernamesGetWithResponseMockTests.java | 40 - ...SenderUsernamesListByDomainsMockTests.java | 40 - .../generated/TaggedResourceTests.java | 39 - .../UpdateDomainPropertiesTests.java | 27 - .../UpdateDomainRequestParametersTests.java | 46 - .../generated/UserAssignedIdentityTests.java | 23 - .../generated/VerificationParameterTests.java | 26 - 123 files changed, 7986 insertions(+), 1901 deletions(-) create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SmtpUsernamesClient.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SuppressionListAddressesClient.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/SuppressionListsClient.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameProperties.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameResourceInner.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListAddressProperties.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListAddressResourceInner.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListProperties.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListResourceInner.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernameResourceImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernamesClientImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernamesImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressResourceImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressesClientImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressesImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListResourceImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListsClientImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListsImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResource.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResourceCollection.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernames.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddressResource.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddressResourceCollection.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListAddresses.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListResource.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionListResourceCollection.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SuppressionLists.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesCreateOrUpdateSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesDeleteSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesGetSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesListSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesCreateOrUpdateSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesDeleteSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesGetSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListAddressesListSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsCreateOrUpdateSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsDeleteSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsGetSamples.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SuppressionListsListByDomainSamples.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CheckNameAvailabilityRequestTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CheckNameAvailabilityResponseInnerTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicePropertiesTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceListTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceUpdateTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/LinkNotificationHubParametersTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/LinkedNotificationHubInnerTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/NameAvailabilityParametersTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationDisplayTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationInnerTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationListResultTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamePropertiesTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceCollectionTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceInnerTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java diff --git a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md index acbe57e074c67..057e752a754cb 100644 --- a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md +++ b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md @@ -1,14 +1,58 @@ # Release History -## 2.3.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2025-02-05) + +- 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-preview-2024-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 -### Bugs Fixed +* `models.SuppressionListResource$Update` was added + +* `models.SmtpUsernameResource$UpdateStages` was added + +* `models.SmtpUsernameResourceCollection` was added + +* `models.SuppressionListAddressResource$Update` was added -### Other Changes +* `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 + +#### `CommunicationManager` was modified + +* `suppressionLists()` was added +* `smtpUsernames()` was added +* `suppressionListAddresses()` 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 a5397cfbbe104..092b49c00c7eb 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-preview-2024-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.2.0 + 2.3.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/communication/azure-resourcemanager-communication/SAMPLE.md b/sdk/communication/azure-resourcemanager-communication/SAMPLE.md index 64998b7f73e60..e7680c316c7f8 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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/examples/ * communicationServices/checkNameAvailabilityUnavailable.json */ /** @@ -101,7 +122,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/preview/2024-09-01-preview/examples/ * communicationServices/createOrUpdate.json */ /** @@ -120,7 +141,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/preview/2024-09-01-preview/examples/ * communicationServices/createOrUpdateWithSystemAssignedIdentity.json */ /** @@ -150,7 +171,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/preview/2024-09-01-preview/examples/ * communicationServices/delete.json */ /** @@ -174,7 +195,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/preview/2024-09-01-preview/examples/ * communicationServices/get.json */ /** @@ -201,7 +222,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/preview/2024-09-01-preview/examples/ * communicationServices/linkNotificationHub.json */ /** @@ -229,7 +250,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/preview/2024-09-01-preview/examples/ * communicationServices/listBySubscription.json */ /** @@ -252,7 +273,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/preview/2024-09-01-preview/examples/ * communicationServices/listByResourceGroup.json */ /** @@ -275,7 +296,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/preview/2024-09-01-preview/examples/ * communicationServices/listKeys.json */ /** @@ -302,7 +323,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/preview/2024-09-01-preview/examples/ * communicationServices/regenerateKey.json */ /** @@ -334,7 +355,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/preview/2024-09-01-preview/examples/ * communicationServices/update.json */ /** @@ -347,12 +368,15 @@ public final class CommunicationServicesUpdateSamples { .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) .getValue(); - resource.update().withTags(mapOf("newTag", "newVal")).apply(); + resource.update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .apply(); } /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ * communicationServices/updateWithUserAssignedIdentity.json */ /** @@ -375,7 +399,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/preview/2024-09-01-preview/examples/ * communicationServices/updateWithSystemAssignedIdentity.json */ /** @@ -397,7 +421,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/preview/2024-09-01-preview/examples/ * communicationServices/updateRemoveSystemIdentity.json */ /** @@ -411,15 +435,12 @@ public final class CommunicationServicesUpdateSamples { .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) .getValue(); - resource.update() - .withTags(mapOf("newTag", "newVal")) - .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)) - .apply(); + resource.update().withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply(); } /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ * communicationServices/updateWithSystemAndUserIdentity.json */ /** @@ -467,7 +488,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/preview/2024-09-01-preview/examples/domains/ * cancelVerification.json */ /** @@ -495,7 +516,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/preview/2024-09-01-preview/examples/domains/ * createOrUpdate.json */ /** @@ -524,8 +545,8 @@ 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. - * json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/domains/ + * delete.json */ /** * Sample code: Delete Domains resource. @@ -548,7 +569,8 @@ 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/preview/2024-09-01-preview/examples/domains/ + * get.json */ /** * Sample code: Get Domains resource. @@ -575,7 +597,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/preview/2024-09-01-preview/examples/domains/ * initiateVerification.json */ /** @@ -601,7 +623,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/preview/2024-09-01-preview/examples/domains/ * listByEmailService.json */ /** @@ -629,8 +651,8 @@ 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. - * json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/domains/ + * update.json */ /** * Sample code: Update Domains resource. @@ -656,8 +678,8 @@ public final class DomainsUpdateSamples { public final class EmailServicesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * createOrUpdate.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/createOrUpdate.json */ /** * Sample code: Create or update EmailService resource. @@ -685,8 +707,8 @@ public final class EmailServicesCreateOrUpdateSamples { public final class EmailServicesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * delete.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/delete.json */ /** * Sample code: Delete EmailService resource. @@ -709,8 +731,8 @@ 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 - * .json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/get.json */ /** * Sample code: Get EmailService resource. @@ -734,8 +756,8 @@ public final class EmailServicesGetByResourceGroupSamples { public final class EmailServicesListSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * listBySubscription.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/listBySubscription.json */ /** * Sample code: List EmailService resources by subscription. @@ -758,8 +780,8 @@ public final class EmailServicesListSamples { public final class EmailServicesListByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * listByResourceGroup.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/listByResourceGroup.json */ /** * Sample code: List EmailService resources by resource group. @@ -782,8 +804,8 @@ public final class EmailServicesListByResourceGroupSamples { public final class EmailServicesListVerifiedExchangeOnlineDomainsSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * getVerifiedExchangeOnlineDomains.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/getVerifiedExchangeOnlineDomains.json */ /** * Sample code: Get verified Exchange Online domains. @@ -810,8 +832,8 @@ import java.util.Map; public final class EmailServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * update.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/update.json */ /** * Sample code: Update EmailService resource. @@ -850,7 +872,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/preview/2024-09-01-preview/examples/ * communicationServices/operationsList.json */ /** @@ -873,8 +895,8 @@ public final class OperationsListSamples { public final class SenderUsernamesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ - * createOrUpdate.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * senderUsernames/createOrUpdate.json */ /** * Sample code: Create or update SenderUsernames resource. @@ -902,8 +924,8 @@ public final class SenderUsernamesCreateOrUpdateSamples { public final class SenderUsernamesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ - * delete.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * senderUsernames/delete.json */ /** * Sample code: Delete SenderUsernames resource. @@ -928,8 +950,8 @@ public final class SenderUsernamesDeleteSamples { public final class SenderUsernamesGetSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ - * get.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * senderUsernames/get.json */ /** * Sample code: Get SenderUsernames resource. @@ -954,16 +976,16 @@ public final class SenderUsernamesGetSamples { public final class SenderUsernamesListByDomainsSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ - * listByDomain.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * senderUsernames/listByDomain.json */ /** - * Sample code: Get SenderUsernames resource. + * Sample code: Get all SenderUsernames resources for a Domain. * * @param manager Entry point to CommunicationManager. */ public static void - getSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + getAllSenderUsernamesResourcesForADomain(com.azure.resourcemanager.communication.CommunicationManager manager) { manager.senderUsernames() .listByDomains("contosoResourceGroup", "contosoEmailService", "contoso.com", com.azure.core.util.Context.NONE); @@ -971,3 +993,326 @@ public final class SenderUsernamesListByDomainsSamples { } ``` +### SmtpUsernames_CreateOrUpdate + +```java +import java.util.UUID; + +/** + * Samples for SmtpUsernames CreateOrUpdate. + */ +public final class SmtpUsernamesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/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(UUID.fromString("aaaa1111-bbbb-2222-3333-aaaa111122bb")) + .withTenantId(UUID.fromString("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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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 fa85c1470a577..d37c8d14546da 100644 --- a/sdk/communication/azure-resourcemanager-communication/pom.xml +++ b/sdk/communication/azure-resourcemanager-communication/pom.xml @@ -18,7 +18,7 @@ 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-preview-2024-09-01. https://github.com/Azure/azure-sdk-for-java @@ -45,6 +45,7 @@ UTF-8 0 0 + true 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 d39d141f3e315..8df4aa44bc8c2 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 @@ -30,11 +30,17 @@ 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; @@ -57,6 +63,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) { @@ -221,7 +233,7 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil .append("-") .append("com.azure.resourcemanager.communication") .append("/") - .append("2.2.0"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -327,6 +339,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 d24e14239ffe7..3ede2630ac806 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 0000000000000..d7e76951471e6 --- /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 0000000000000..869f0e4239d4e --- /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 0000000000000..799363d149f52 --- /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/SmtpUsernameProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameProperties.java new file mode 100644 index 0000000000000..933cdb5756782 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameProperties.java @@ -0,0 +1,172 @@ +// 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; +import java.util.Objects; +import java.util.UUID; + +/** + * 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 UUID entraApplicationId; + + /* + * The tenant of the linked Entra Application. + */ + private UUID 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 UUID 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(UUID entraApplicationId) { + this.entraApplicationId = entraApplicationId; + return this; + } + + /** + * Get the tenantId property: The tenant of the linked Entra Application. + * + * @return the tenantId value. + */ + public UUID 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(UUID 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", Objects.toString(this.entraApplicationId, null)); + jsonWriter.writeStringField("tenantId", Objects.toString(this.tenantId, null)); + 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.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedSmtpUsernameProperties.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.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 0000000000000..28581c2fe3899 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SmtpUsernameResourceInner.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.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.util.UUID; + +/** + * 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 UUID 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(UUID 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 UUID 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(UUID 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 0000000000000..11e3108eb3606 --- /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 0000000000000..28054b5d02b39 --- /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 0000000000000..641a3232134ff --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SuppressionListProperties.java @@ -0,0 +1,146 @@ +// 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 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 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 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 0000000000000..077be53f1a712 --- /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 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 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 ce3b59febe14d..1890f52866976 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 @@ -29,6 +29,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 +200,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 +259,15 @@ public SenderUsernamesClient getSenderUsernames() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2023-04-01"; + this.apiVersion = "2024-09-01-preview"; 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); } /** 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 0000000000000..b26b9837b7e16 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernameResourceImpl.java @@ -0,0 +1,158 @@ +// 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; +import java.util.UUID; + +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 UUID entraApplicationId() { + return this.innerModel().entraApplicationId(); + } + + public UUID 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(UUID entraApplicationId) { + this.innerModel().withEntraApplicationId(entraApplicationId); + return this; + } + + public SmtpUsernameResourceImpl withTenantId(UUID 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 0000000000000..0c1ebc2a4d8a6 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SmtpUsernamesClientImpl.java @@ -0,0 +1,777 @@ +// 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.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 = "CommunicationService") + 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/{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" }) + @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" }) + @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" }) + @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); + } + + /** + * 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 + .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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String communicationServiceName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, communicationServiceName, context), + nextLink -> listNextSinglePageAsync(nextLink, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String communicationServiceName) { + return new PagedIterable<>(listAsync(resourceGroupName, 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 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<>(listAsync(resourceGroupName, communicationServiceName, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String communicationServiceName, String smtpUsername, 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 (smtpUsername == null) { + return Mono.error(new IllegalArgumentException("Parameter smtpUsername 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, 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 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) { + return getWithResponseAsync(resourceGroupName, communicationServiceName, smtpUsername, context).block(); + } + + /** + * 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. + * @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} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String communicationServiceName, String smtpUsername, SmtpUsernameResourceInner 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 (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"; + context = this.client.mergeContext(context); + return service.createOrUpdate(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 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) { + return createOrUpdateWithResponseAsync(resourceGroupName, communicationServiceName, smtpUsername, parameters, + context).block(); + } + + /** + * 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. + * @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 communicationServiceName, + String smtpUsername, 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 (smtpUsername == null) { + return Mono.error(new IllegalArgumentException("Parameter smtpUsername 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, 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. + * @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) { + return deleteWithResponseAsync(resourceGroupName, communicationServiceName, smtpUsername, context).block(); + } + + /** + * 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 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 collection of SmtpUsername resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of SmtpUsername resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} 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 0000000000000..1466c70a4613b --- /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 0000000000000..3644d08f0cb9c --- /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 0000000000000..51af043f6cb3e --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListAddressesClientImpl.java @@ -0,0 +1,896 @@ +// 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.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 = "CommunicationService") + 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/{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" }) + @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" }) + @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" }) + @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); + } + + /** + * 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. + * @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} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, 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 (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName 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(), + resourceGroupName, emailServiceName, domainName, suppressionListName, accept, context) + .map(res -> 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 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, context), + nextLink -> listNextSinglePageAsync(nextLink, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String emailServiceName, + String domainName, String suppressionListName) { + return new PagedIterable<>(listAsync(resourceGroupName, emailServiceName, domainName, 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 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<>( + listAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, String addressId, 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 (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"; + context = this.client.mergeContext(context); + return service.get(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 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) { + return getWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + context).block(); + } + + /** + * 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. + * @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} 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, 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 (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"; + context = this.client.mergeContext(context); + return service.createOrUpdate(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 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) { + return createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, + addressId, parameters, context).block(); + } + + /** + * 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. + * @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 suppressionListName, String addressId, 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 (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"; + context = this.client.mergeContext(context); + return service.delete(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. + * @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) { + return deleteWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, + context).block(); + } + + /** + * 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 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 collection of 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 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 collection of addresses in a suppression list along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} 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 0000000000000..d52522f9604f3 --- /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 0000000000000..1cd13e5b1964a --- /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 0000000000000..8be9a68154297 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SuppressionListsClientImpl.java @@ -0,0 +1,852 @@ +// 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.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 = "CommunicationService") + 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/{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" }) + @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" }) + @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" }) + @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); + } + + /** + * 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. + * @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} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDomainSinglePageAsync(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 + .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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDomainAsync(String resourceGroupName, String emailServiceName, + String domainName, Context context) { + return new PagedFlux<>( + () -> listByDomainSinglePageAsync(resourceGroupName, emailServiceName, domainName, context), + nextLink -> listByDomainNextSinglePageAsync(nextLink, 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 as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDomain(String resourceGroupName, String emailServiceName, + String domainName) { + return new PagedIterable<>(listByDomainAsync(resourceGroupName, emailServiceName, 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 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<>(listByDomainAsync(resourceGroupName, emailServiceName, domainName, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, 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 (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName 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, 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 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) { + return getWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, context) + .block(); + } + + /** + * 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. + * @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} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String emailServiceName, String domainName, String suppressionListName, SuppressionListResourceInner 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 (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"; + context = this.client.mergeContext(context); + return service.createOrUpdate(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 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) { + return createOrUpdateWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, + parameters, context).block(); + } + + /** + * 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. + * @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 suppressionListName, 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 (suppressionListName == null) { + return Mono + .error(new IllegalArgumentException("Parameter suppressionListName 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, 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. + * @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) { + return deleteWithResponseAsync(resourceGroupName, emailServiceName, domainName, suppressionListName, context) + .block(); + } + + /** + * 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); + } + + /** + * 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())); + } + + /** + * 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} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDomainNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByDomainNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} 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 0000000000000..3598a0ecb934e --- /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/SmtpUsernameResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResource.java new file mode 100644 index 0000000000000..59fb9dea55bda --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SmtpUsernameResource.java @@ -0,0 +1,257 @@ +// 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; +import java.util.UUID; + +/** + * 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. + */ + UUID entraApplicationId(); + + /** + * Gets the tenantId property: The tenant of the linked Entra Application. + * + * @return the tenantId value. + */ + UUID 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(UUID 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(UUID 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(UUID 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(UUID 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 0000000000000..d6da1155da531 --- /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 0000000000000..13471779d2413 --- /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 0000000000000..bcd43c596fdc6 --- /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 0000000000000..ff9d096ddf849 --- /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 0000000000000..141fa327d1f0a --- /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 0000000000000..9bc0a9e516374 --- /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 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 the name of the suppression list. This value must match one of the + * valid sender usernames of the sending domain.. + * + * @param listName The 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 the name of the suppression list. This value must match one of the + * valid sender usernames of the sending domain.. + * + * @param listName The 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 0000000000000..059639d7d4079 --- /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 0000000000000..bf22eb6235c95 --- /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 814adfa4e50fa..b963f5049be35 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/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 f2b2def9dd72d..d323b92b75fff 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/preview/2024-09-01-preview/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/preview/2024-09-01-preview/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 2885f33fe237c..4c6ac8926f796 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 @@ -13,7 +13,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/preview/2024-09-01-preview/examples/ * communicationServices/createOrUpdate.json */ /** @@ -32,7 +32,7 @@ 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/preview/2024-09-01-preview/examples/ * communicationServices/createOrUpdateWithSystemAssignedIdentity.json */ /** 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 703e279188da3..e66db7afa9029 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/preview/2024-09-01-preview/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 ff6665ac2c037..a5a1b89937d1e 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/preview/2024-09-01-preview/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 c6d21ee609e17..109330fc5d56e 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/preview/2024-09-01-preview/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 341fcfbc849c6..5a354bab559b8 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/preview/2024-09-01-preview/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 937f1dbe01579..d8a5b602bc6e5 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/preview/2024-09-01-preview/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 bd0f4147bed32..bb2ceaa721863 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/preview/2024-09-01-preview/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 f53f42e767dac..1cb1b01ace12e 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/preview/2024-09-01-preview/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 b0c1204370e1a..7e83d612dea9a 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 @@ -17,7 +17,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/preview/2024-09-01-preview/examples/ * communicationServices/update.json */ /** @@ -30,12 +30,15 @@ public static void updateResource(com.azure.resourcemanager.communication.Commun .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) .getValue(); - resource.update().withTags(mapOf("newTag", "newVal")).apply(); + resource.update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .apply(); } /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ * communicationServices/updateWithUserAssignedIdentity.json */ /** @@ -58,7 +61,7 @@ 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/preview/2024-09-01-preview/examples/ * communicationServices/updateWithSystemAssignedIdentity.json */ /** @@ -80,7 +83,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/preview/2024-09-01-preview/examples/ * communicationServices/updateRemoveSystemIdentity.json */ /** @@ -94,15 +97,12 @@ public static void updateResourceToAddASystemAssignedManagedIdentity( .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) .getValue(); - resource.update() - .withTags(mapOf("newTag", "newVal")) - .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)) - .apply(); + resource.update().withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply(); } /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/ + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/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 6b988ec97d3bc..2667e105bc7c2 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/preview/2024-09-01-preview/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 727249420c679..c2073e6053103 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/preview/2024-09-01-preview/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 0ba66faf90aaf..f40f3fdbb4c0d 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,8 +10,8 @@ public final class DomainsDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/delete. - * json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/domains/ + * delete.json */ /** * Sample code: Delete Domains resource. 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 abc3106b1eee7..137bd23bd3c77 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,8 @@ 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/preview/2024-09-01-preview/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 ab5b371351bf2..66831276c8165 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/preview/2024-09-01-preview/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 dba15c81b5aa7..aee9a669a0503 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/preview/2024-09-01-preview/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 28333abdfb60a..ac43a26971d91 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,8 +13,8 @@ public final class DomainsUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/update. - * json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/domains/ + * update.json */ /** * Sample code: Update Domains resource. 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 d9db566d39aa3..c3574511a0d94 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,8 +10,8 @@ public final class EmailServicesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * createOrUpdate.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/createOrUpdate.json */ /** * Sample code: Create or update EmailService resource. 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 f2f87f8196bf8..13f614f03b16b 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,8 +10,8 @@ public final class EmailServicesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * delete.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/delete.json */ /** * Sample code: Delete EmailService resource. 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 3b1209179819d..b7e46da835c34 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,8 +10,8 @@ public final class EmailServicesGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/get - * .json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/get.json */ /** * Sample code: Get EmailService resource. 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 71e848533b301..93e290c5f70c3 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,8 +10,8 @@ public final class EmailServicesListByResourceGroupSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * listByResourceGroup.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/listByResourceGroup.json */ /** * Sample code: List EmailService resources by resource group. 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 6c08aae8b9bf1..762e748cee6b0 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,8 +10,8 @@ public final class EmailServicesListSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * listBySubscription.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/listBySubscription.json */ /** * Sample code: List EmailService resources by subscription. 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 577b34d64a73f..916b13e370e05 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,8 +10,8 @@ public final class EmailServicesListVerifiedExchangeOnlineDomainsSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * getVerifiedExchangeOnlineDomains.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/getVerifiedExchangeOnlineDomains.json */ /** * Sample code: Get verified Exchange Online domains. 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 90abf280286a4..cb41386ae6407 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,8 +14,8 @@ public final class EmailServicesUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/ - * update.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * emailServices/update.json */ /** * Sample code: Update EmailService resource. 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 4585b92af1729..9579bde86318d 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/preview/2024-09-01-preview/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 7e1519ac0dd07..5d5a16f7bf04a 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,8 +10,8 @@ public final class SenderUsernamesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ - * createOrUpdate.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * senderUsernames/createOrUpdate.json */ /** * Sample code: Create or update SenderUsernames resource. 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 5abb8137e29be..8e4ce1bddd440 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,8 +10,8 @@ public final class SenderUsernamesDeleteSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ - * delete.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * senderUsernames/delete.json */ /** * Sample code: Delete SenderUsernames resource. 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 0cd27a5bc6e32..17a0f09201218 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,8 +10,8 @@ public final class SenderUsernamesGetSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ - * get.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * senderUsernames/get.json */ /** * Sample code: Get SenderUsernames resource. 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 bfeeade7fd4d2..65c052232cad4 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,16 +10,16 @@ public final class SenderUsernamesListByDomainsSamples { /* * x-ms-original-file: - * specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/ - * listByDomain.json + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/examples/ + * senderUsernames/listByDomain.json */ /** - * Sample code: Get SenderUsernames resource. + * Sample code: Get all SenderUsernames resources for a Domain. * * @param manager Entry point to CommunicationManager. */ public static void - getSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { + getAllSenderUsernamesResourcesForADomain(com.azure.resourcemanager.communication.CommunicationManager manager) { manager.senderUsernames() .listByDomains("contosoResourceGroup", "contosoEmailService", "contoso.com", com.azure.core.util.Context.NONE); 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 0000000000000..54557d72d9461 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SmtpUsernamesCreateOrUpdateSamples.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 java.util.UUID; + +/** + * Samples for SmtpUsernames CreateOrUpdate. + */ +public final class SmtpUsernamesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/communication/resource-manager/Microsoft.Communication/preview/2024-09-01-preview/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(UUID.fromString("aaaa1111-bbbb-2222-3333-aaaa111122bb")) + .withTenantId(UUID.fromString("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 0000000000000..aa39cc8cc5cce --- /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/preview/2024-09-01-preview/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 0000000000000..6a285434ca93a --- /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/preview/2024-09-01-preview/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 0000000000000..4bb48a10c6499 --- /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/preview/2024-09-01-preview/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 0000000000000..12958424dc276 --- /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/preview/2024-09-01-preview/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 0000000000000..b3c7723d67bb5 --- /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/preview/2024-09-01-preview/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 0000000000000..b2b481bd78b2b --- /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/preview/2024-09-01-preview/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 0000000000000..be08e66063311 --- /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/preview/2024-09-01-preview/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 0000000000000..374b45eb68599 --- /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/preview/2024-09-01-preview/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 0000000000000..ae6a278d6aaf8 --- /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/preview/2024-09-01-preview/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 0000000000000..ae7ca450bc073 --- /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/preview/2024-09-01-preview/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 0000000000000..3e53b3e13dc89 --- /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/preview/2024-09-01-preview/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/CheckNameAvailabilityRequestTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CheckNameAvailabilityRequestTests.java deleted file mode 100644 index d9c451598d7da..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CheckNameAvailabilityRequestTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.CheckNameAvailabilityRequest; -import org.junit.jupiter.api.Assertions; - -public final class CheckNameAvailabilityRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckNameAvailabilityRequest model = BinaryData.fromString("{\"name\":\"hab\",\"type\":\"pikxwczbyscnpqxu\"}") - .toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("hab", model.name()); - Assertions.assertEquals("pikxwczbyscnpqxu", model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckNameAvailabilityRequest model - = new CheckNameAvailabilityRequest().withName("hab").withType("pikxwczbyscnpqxu"); - model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("hab", model.name()); - Assertions.assertEquals("pikxwczbyscnpqxu", model.type()); - } -} 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 deleted file mode 100644 index 673aadbf309b0..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CheckNameAvailabilityResponseInnerTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.CheckNameAvailabilityResponseInner; -import com.azure.resourcemanager.communication.models.CheckNameAvailabilityReason; -import org.junit.jupiter.api.Assertions; - -public final class CheckNameAvailabilityResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckNameAvailabilityResponseInner model = BinaryData - .fromString("{\"nameAvailable\":false,\"reason\":\"AlreadyExists\",\"message\":\"iwbybrkxvdumjg\"}") - .toObject(CheckNameAvailabilityResponseInner.class); - Assertions.assertEquals(false, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, model.reason()); - Assertions.assertEquals("iwbybrkxvdumjg", model.message()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckNameAvailabilityResponseInner model = new CheckNameAvailabilityResponseInner().withNameAvailable(false) - .withReason(CheckNameAvailabilityReason.ALREADY_EXISTS) - .withMessage("iwbybrkxvdumjg"); - model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityResponseInner.class); - Assertions.assertEquals(false, 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 deleted file mode 100644 index ea670610f29b9..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -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\"]}") - .toObject(CommunicationServiceProperties.class); - Assertions.assertEquals("kdosvqw", model.dataLocation()); - Assertions.assertEquals("algbquxigjyjg", model.linkedDomains().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CommunicationServiceProperties model = new CommunicationServiceProperties().withDataLocation("kdosvqw") - .withLinkedDomains(Arrays.asList("algbquxigjyjg")); - model = BinaryData.fromObject(model).toObject(CommunicationServiceProperties.class); - Assertions.assertEquals("kdosvqw", model.dataLocation()); - Assertions.assertEquals("algbquxigjyjg", model.linkedDomains().get(0)); - } -} 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 deleted file mode 100644 index 257db00321dee..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -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.UserAssignedIdentity; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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\"}") - .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)); - } - - @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")); - 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)); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/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 deleted file mode 100644 index 32e1755b0da4f..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; -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.UserAssignedIdentity; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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\"}") - .toObject(CommunicationServiceResourceList.class); - Assertions.assertEquals("yoqpsoaccta", model.value().get(0).location()); - Assertions.assertEquals("ljlahbcryf", model.value().get(0).tags().get("dfdosygexp")); - 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()); - } - - @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"); - 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(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()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/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 deleted file mode 100644 index 0ad75909c2ea2..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -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.UserAssignedIdentity; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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\"}}") - .toObject(CommunicationServiceResourceUpdate.class); - Assertions.assertEquals("a", model.tags().get("x")); - Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); - Assertions.assertEquals("jvtbvpyss", model.linkedDomains().get(0)); - } - - @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")); - model = BinaryData.fromObject(model).toObject(CommunicationServiceResourceUpdate.class); - Assertions.assertEquals("a", model.tags().get("x")); - Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); - Assertions.assertEquals("jvtbvpyss", model.linkedDomains().get(0)); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/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 deleted file mode 100644 index baf6bbdd96986..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceUpdateProperties; -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)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CommunicationServiceUpdateProperties model = new CommunicationServiceUpdateProperties() - .withLinkedDomains(Arrays.asList("fvzwdzuhty", "wisdkft", "wxmnteiwao")); - model = BinaryData.fromObject(model).toObject(CommunicationServiceUpdateProperties.class); - Assertions.assertEquals("fvzwdzuhty", model.linkedDomains().get(0)); - } -} 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 deleted file mode 100644 index 0fafff202bfed..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.CheckNameAvailabilityReason; -import com.azure.resourcemanager.communication.models.CheckNameAvailabilityResponse; -import com.azure.resourcemanager.communication.models.NameAvailabilityParameters; -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 CommunicationServicesCheckNameAvailabilityWithResponseMockTests { - @Test - public void testCheckNameAvailabilityWithResponse() throws Exception { - String responseStr = "{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"eyp\"}"; - - 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)); - - CheckNameAvailabilityResponse response = manager.communicationServices() - .checkNameAvailabilityWithResponse( - new NameAvailabilityParameters().withName("xzko").withType("cukoklyaxuconu"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(false, response.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, response.reason()); - Assertions.assertEquals("eyp", 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 deleted file mode 100644 index c7b3450a93bed..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.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.UserAssignedIdentity; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class 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\"}"; - - 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)); - - CommunicationServiceResource response = manager.communicationServices() - .define("kfrlhrxsbky") - .withRegion("hcdhmdual") - .withExistingResourceGroup("bh") - .withTags(mapOf("adm", "qpv", "r", "sr", "fmisg", "vxpvgomz")) - .withIdentity( - new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities(mapOf("ahvljuaha", new UserAssignedIdentity()))) - .withDataLocation("z") - .withLinkedDomains(Arrays.asList("eyvjusrtslhspkde", "maofmxagkv")) - .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)); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/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 deleted file mode 100644 index 7fa5ec33f0019..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.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 CommunicationServicesDeleteMockTests { - @Test - public void testDelete() 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("", "", AzureEnvironment.AZURE)); - - manager.communicationServices().delete("uscrpabgyepsb", "tazqugxywpmueefj", 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 deleted file mode 100644 index 87eecc5151a10..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.CommunicationServiceResource; -import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; -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 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\"}"; - - 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)); - - CommunicationServiceResource response = manager.communicationServices() - .getByResourceGroupWithResponse("ovplw", "bhvgy", 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)); - } -} 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 deleted file mode 100644 index 36573d8b4a5f6..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.LinkNotificationHubParameters; -import com.azure.resourcemanager.communication.models.LinkedNotificationHub; -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 CommunicationServicesLinkNotificationHubWithResponseMockTests { - @Test - public void testLinkNotificationHubWithResponse() throws Exception { - String responseStr = "{\"resourceId\":\"civfsnkymuctq\"}"; - - 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)); - - LinkedNotificationHub response - = manager.communicationServices() - .linkNotificationHubWithResponse("wrmjmwvvjektc", "senhwlrs", - new LinkNotificationHubParameters().withResourceId("frzpwvlqdqgb") - .withConnectionString("qylihkaetckt"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("civfsnkymuctq", 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 deleted file mode 100644 index bc93d780d7ac8..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.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.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -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 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 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\"}]}"; - - 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)); - - PagedIterable response - = manager.communicationServices().listByResourceGroup("buynhijggm", 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)); - } -} 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 deleted file mode 100644 index 1bf79cb1d3c99..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.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.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -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 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 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\"}]}"; - - 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)); - - 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)); - } -} 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 deleted file mode 100644 index 365d15b0d3786..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.DnsRecord; - -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); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DnsRecord model = new DnsRecord(); - model = BinaryData.fromObject(model).toObject(DnsRecord.class); - } -} 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 deleted file mode 100644 index 4e8bf2f106b31..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.DnsRecord; -import com.azure.resourcemanager.communication.models.DomainPropertiesVerificationRecords; - -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}}") - .toObject(DomainPropertiesVerificationRecords.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DomainPropertiesVerificationRecords model - = new DomainPropertiesVerificationRecords().withDomain(new DnsRecord()) - .withSpf(new DnsRecord()) - .withDkim(new DnsRecord()) - .withDkim2(new DnsRecord()) - .withDmarc(new DnsRecord()); - model = BinaryData.fromObject(model).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 deleted file mode 100644 index 8977e58e32fdb..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.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 DomainsDeleteMockTests { - @Test - public void testDelete() 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("", "", AzureEnvironment.AZURE)); - - manager.domains().delete("yriwwroyqb", "xrmcqibycnojvk", "mefqsgzvahapjyzh", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicePropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicePropertiesTests.java deleted file mode 100644 index dd0148634f9fc..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicePropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.EmailServiceProperties; -import org.junit.jupiter.api.Assertions; - -public final class EmailServicePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EmailServiceProperties model - = BinaryData.fromString("{\"provisioningState\":\"Updating\",\"dataLocation\":\"zgpphrcgyncocpe\"}") - .toObject(EmailServiceProperties.class); - Assertions.assertEquals("zgpphrcgyncocpe", model.dataLocation()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EmailServiceProperties model = new EmailServiceProperties().withDataLocation("zgpphrcgyncocpe"); - model = BinaryData.fromObject(model).toObject(EmailServiceProperties.class); - Assertions.assertEquals("zgpphrcgyncocpe", model.dataLocation()); - } -} 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 deleted file mode 100644 index 6fc86211775df..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.EmailServiceResourceInner; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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\"}") - .toObject(EmailServiceResourceInner.class); - Assertions.assertEquals("ghmewuam", model.location()); - Assertions.assertEquals("rzayv", model.tags().get("t")); - Assertions.assertEquals("igdtopbob", 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"); - model = BinaryData.fromObject(model).toObject(EmailServiceResourceInner.class); - Assertions.assertEquals("ghmewuam", model.location()); - Assertions.assertEquals("rzayv", model.tags().get("t")); - Assertions.assertEquals("igdtopbob", model.dataLocation()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceListTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceListTests.java deleted file mode 100644 index 890233ec23694..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceListTests.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.EmailServiceResourceInner; -import com.azure.resourcemanager.communication.models.EmailServiceResourceList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class EmailServiceResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EmailServiceResourceList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Moving\",\"dataLocation\":\"c\"},\"location\":\"nfnbacfionlebxe\",\"tags\":{\"jfeallnwsub\":\"tzxdpnqbqqwx\",\"zscxaqwo\":\"snjampmng\"},\"id\":\"chcbonqvpkvlrxnj\",\"name\":\"ase\",\"type\":\"pheoflokeyy\"},{\"properties\":{\"provisioningState\":\"Unknown\",\"dataLocation\":\"bdlwtgrhpdjpj\"},\"location\":\"asxazjpqyegualhb\",\"tags\":{\"jzzvdud\":\"e\",\"pwlbjnpg\":\"wdslfhotwmcy\"},\"id\":\"cftadeh\",\"name\":\"nltyfsoppusuesnz\",\"type\":\"dejbavo\"},{\"properties\":{\"provisioningState\":\"Running\",\"dataLocation\":\"mohctb\"},\"location\":\"udwxdndnvowguj\",\"tags\":{\"zj\":\"wdkcglhsl\",\"kuofqweykhme\":\"yggdtjixh\",\"yvdcsitynnaa\":\"evfyexfwhybcib\"},\"id\":\"dectehfiqsc\",\"name\":\"eypvhezrkg\",\"type\":\"hcjrefovgmk\"},{\"properties\":{\"provisioningState\":\"Unknown\",\"dataLocation\":\"yyvxyqjpkcattpn\"},\"location\":\"cr\",\"tags\":{\"sounqecanoaeu\":\"sqpjhvmdajvn\",\"u\":\"fhyhltrpmopjmcma\",\"aodsfcpkv\":\"kthfui\",\"uaxbezyiuokkt\":\"odpuozmyzydag\"},\"id\":\"hrdxwzywqsmbs\",\"name\":\"reximoryocfs\",\"type\":\"ksymd\"}],\"nextLink\":\"stkiiuxhqyud\"}") - .toObject(EmailServiceResourceList.class); - Assertions.assertEquals("nfnbacfionlebxe", model.value().get(0).location()); - Assertions.assertEquals("tzxdpnqbqqwx", model.value().get(0).tags().get("jfeallnwsub")); - Assertions.assertEquals("c", model.value().get(0).dataLocation()); - Assertions.assertEquals("stkiiuxhqyud", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EmailServiceResourceList model = new EmailServiceResourceList().withValue(Arrays.asList( - new EmailServiceResourceInner().withLocation("nfnbacfionlebxe") - .withTags(mapOf("jfeallnwsub", "tzxdpnqbqqwx", "zscxaqwo", "snjampmng")) - .withDataLocation("c"), - new EmailServiceResourceInner().withLocation("asxazjpqyegualhb") - .withTags(mapOf("jzzvdud", "e", "pwlbjnpg", "wdslfhotwmcy")) - .withDataLocation("bdlwtgrhpdjpj"), - new EmailServiceResourceInner().withLocation("udwxdndnvowguj") - .withTags(mapOf("zj", "wdkcglhsl", "kuofqweykhme", "yggdtjixh", "yvdcsitynnaa", "evfyexfwhybcib")) - .withDataLocation("mohctb"), - new EmailServiceResourceInner().withLocation("cr") - .withTags(mapOf("sounqecanoaeu", "sqpjhvmdajvn", "u", "fhyhltrpmopjmcma", "aodsfcpkv", "kthfui", - "uaxbezyiuokkt", "odpuozmyzydag")) - .withDataLocation("yyvxyqjpkcattpn"))) - .withNextLink("stkiiuxhqyud"); - model = BinaryData.fromObject(model).toObject(EmailServiceResourceList.class); - Assertions.assertEquals("nfnbacfionlebxe", model.value().get(0).location()); - Assertions.assertEquals("tzxdpnqbqqwx", model.value().get(0).tags().get("jfeallnwsub")); - Assertions.assertEquals("c", model.value().get(0).dataLocation()); - Assertions.assertEquals("stkiiuxhqyud", model.nextLink()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceUpdateTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceUpdateTests.java deleted file mode 100644 index e47ede66704c6..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceUpdateTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.EmailServiceResourceUpdate; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class EmailServiceResourceUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EmailServiceResourceUpdate model - = BinaryData.fromString("{\"tags\":{\"coofsxlzev\":\"m\",\"abcypmivk\":\"bmqj\"}}") - .toObject(EmailServiceResourceUpdate.class); - Assertions.assertEquals("m", model.tags().get("coofsxlzev")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EmailServiceResourceUpdate model - = new EmailServiceResourceUpdate().withTags(mapOf("coofsxlzev", "m", "abcypmivk", "bmqj")); - model = BinaryData.fromObject(model).toObject(EmailServiceResourceUpdate.class); - Assertions.assertEquals("m", model.tags().get("coofsxlzev")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/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 deleted file mode 100644 index 7d6c559cd88de..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.EmailServiceResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class 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\"}"; - - 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)); - - EmailServiceResource response = manager.emailServices() - .define("mnvdfzn") - .withRegion("hh") - .withExistingResourceGroup("mcwyhzdxssadb") - .withTags(mapOf("wjmy", "zdzucerscdntnevf", "s", "tdss", "emwabnet", "tmweriofzpyq", "d", "hhszh")) - .withDataLocation("dvxzbncblylpst") - .create(); - - Assertions.assertEquals("qzeqqkdltfzxm", response.location()); - Assertions.assertEquals("hgure", response.tags().get("dkwobdagx")); - Assertions.assertEquals("xogaokonzmnsikv", response.dataLocation()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/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 deleted file mode 100644 index 9fd389f8620b0..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.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 EmailServicesDeleteMockTests { - @Test - public void testDelete() 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("", "", AzureEnvironment.AZURE)); - - manager.emailServices().delete("j", "n", 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 deleted file mode 100644 index 79ff6e600cc61..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.EmailServiceResource; -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 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\"}"; - - 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)); - - EmailServiceResource response = manager.emailServices() - .getByResourceGroupWithResponse("bnxknalaulppg", "dtpnapnyiropuhp", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("n", response.location()); - Assertions.assertEquals("ncw", response.tags().get("zhxgktrmgucn")); - Assertions.assertEquals("gylgqgitxmedjvcs", 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 deleted file mode 100644 index e5fd8be78eaa5..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.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.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.EmailServiceResource; -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 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\"}]}"; - - 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)); - - PagedIterable response - = manager.emailServices().listByResourceGroup("t", 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()); - } -} 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 deleted file mode 100644 index ca12011cd3e9b..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.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.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.EmailServiceResource; -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 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\"}]}"; - - 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)); - - 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()); - } -} 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 deleted file mode 100644 index 2255ecfc3236f..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests { - @Test - public void testListVerifiedExchangeOnlineDomainsWithResponse() throws Exception { - String responseStr = "[\"olpsslqlf\",\"mdnbbglzpswiy\"]"; - - 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)); - - List response = manager.emailServices() - .listVerifiedExchangeOnlineDomainsWithResponse(com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("olpsslqlf", response.get(0)); - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/LinkNotificationHubParametersTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/LinkNotificationHubParametersTests.java deleted file mode 100644 index c90378d1c578f..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/LinkNotificationHubParametersTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.LinkNotificationHubParameters; -import org.junit.jupiter.api.Assertions; - -public final class LinkNotificationHubParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LinkNotificationHubParameters model - = BinaryData.fromString("{\"resourceId\":\"tfwvukxgaudc\",\"connectionString\":\"snhsjcnyejhkryh\"}") - .toObject(LinkNotificationHubParameters.class); - Assertions.assertEquals("tfwvukxgaudc", model.resourceId()); - Assertions.assertEquals("snhsjcnyejhkryh", model.connectionString()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LinkNotificationHubParameters model = new LinkNotificationHubParameters().withResourceId("tfwvukxgaudc") - .withConnectionString("snhsjcnyejhkryh"); - model = BinaryData.fromObject(model).toObject(LinkNotificationHubParameters.class); - Assertions.assertEquals("tfwvukxgaudc", model.resourceId()); - Assertions.assertEquals("snhsjcnyejhkryh", model.connectionString()); - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/LinkedNotificationHubInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/LinkedNotificationHubInnerTests.java deleted file mode 100644 index 18b6b516f51c7..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/LinkedNotificationHubInnerTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner; -import org.junit.jupiter.api.Assertions; - -public final class LinkedNotificationHubInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LinkedNotificationHubInner model - = BinaryData.fromString("{\"resourceId\":\"apcz\"}").toObject(LinkedNotificationHubInner.class); - Assertions.assertEquals("apcz", model.resourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LinkedNotificationHubInner model = new LinkedNotificationHubInner().withResourceId("apcz"); - model = BinaryData.fromObject(model).toObject(LinkedNotificationHubInner.class); - Assertions.assertEquals("apcz", model.resourceId()); - } -} 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 deleted file mode 100644 index 31eb9a3fcf5a9..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; -import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; -import com.azure.resourcemanager.communication.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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\"}}}") - .toObject(ManagedServiceIdentity.class); - Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.type()); - } - - @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())); - model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); - Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.type()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/NameAvailabilityParametersTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/NameAvailabilityParametersTests.java deleted file mode 100644 index aea4e50ecf075..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/NameAvailabilityParametersTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.NameAvailabilityParameters; -import org.junit.jupiter.api.Assertions; - -public final class NameAvailabilityParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NameAvailabilityParameters model - = BinaryData.fromString("{\"name\":\"a\",\"type\":\"th\"}").toObject(NameAvailabilityParameters.class); - Assertions.assertEquals("a", model.name()); - Assertions.assertEquals("th", model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NameAvailabilityParameters model = new NameAvailabilityParameters().withName("a").withType("th"); - model = BinaryData.fromObject(model).toObject(NameAvailabilityParameters.class); - Assertions.assertEquals("a", model.name()); - Assertions.assertEquals("th", model.type()); - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationDisplayTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationDisplayTests.java deleted file mode 100644 index 179d0f248df27..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationDisplayTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.OperationDisplay; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = BinaryData.fromString( - "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") - .toObject(OperationDisplay.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationInnerTests.java deleted file mode 100644 index bad8ca847d5f5..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationInnerTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.OperationInner; -import com.azure.resourcemanager.communication.models.OperationDisplay; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = BinaryData.fromString( - "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") - .toObject(OperationInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationListResultTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationListResultTests.java deleted file mode 100644 index dc5095052b8d0..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.OperationListResult; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = BinaryData.fromString( - "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") - .toObject(OperationListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - } -} diff --git a/sdk/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 deleted file mode 100644 index 9f9032b824866..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.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.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.Operation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -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\"}]}"; - - 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)); - - 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/SenderUsernamePropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamePropertiesTests.java deleted file mode 100644 index 82ad1002044af..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamePropertiesTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.SenderUsernameProperties; -import org.junit.jupiter.api.Assertions; - -public final class SenderUsernamePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SenderUsernameProperties model = BinaryData.fromString( - "{\"dataLocation\":\"gshwankixz\",\"username\":\"injep\",\"displayName\":\"tmryw\",\"provisioningState\":\"Running\"}") - .toObject(SenderUsernameProperties.class); - Assertions.assertEquals("injep", model.username()); - Assertions.assertEquals("tmryw", model.displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SenderUsernameProperties model = new SenderUsernameProperties().withUsername("injep").withDisplayName("tmryw"); - model = BinaryData.fromObject(model).toObject(SenderUsernameProperties.class); - Assertions.assertEquals("injep", model.username()); - Assertions.assertEquals("tmryw", model.displayName()); - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceCollectionTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceCollectionTests.java deleted file mode 100644 index b137c3f5dbe99..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceCollectionTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.SenderUsernameResourceInner; -import com.azure.resourcemanager.communication.models.SenderUsernameResourceCollection; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SenderUsernameResourceCollectionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SenderUsernameResourceCollection model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"dataLocation\":\"nbpoczvyifqrvkdv\",\"username\":\"sllr\",\"displayName\":\"vdfwatkpn\",\"provisioningState\":\"Unknown\"},\"id\":\"xxbczwtr\",\"name\":\"wiqzbqjvsovmyo\",\"type\":\"acspkwl\"},{\"properties\":{\"dataLocation\":\"obpxjmflbvvn\",\"username\":\"hrk\",\"displayName\":\"iwwzjuqk\",\"provisioningState\":\"Failed\"},\"id\":\"jiwkuofoskghsau\",\"name\":\"imjm\",\"type\":\"xieduugidyjrr\"},{\"properties\":{\"dataLocation\":\"aos\",\"username\":\"e\",\"displayName\":\"sonpclhocohs\",\"provisioningState\":\"Unknown\"},\"id\":\"leggzfbu\",\"name\":\"fmvfaxkffeiit\",\"type\":\"lvmezyvshxmzsbbz\"},{\"properties\":{\"dataLocation\":\"igrxwburvjxxjn\",\"username\":\"pydptko\",\"displayName\":\"kouknvudwtiu\",\"provisioningState\":\"Unknown\"},\"id\":\"ngkpocipazy\",\"name\":\"o\",\"type\":\"gukgjnpiucgygevq\"}],\"nextLink\":\"typmrbpizcdrqjsd\"}") - .toObject(SenderUsernameResourceCollection.class); - Assertions.assertEquals("sllr", model.value().get(0).username()); - Assertions.assertEquals("vdfwatkpn", model.value().get(0).displayName()); - Assertions.assertEquals("typmrbpizcdrqjsd", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SenderUsernameResourceCollection model = new SenderUsernameResourceCollection() - .withValue( - Arrays.asList(new SenderUsernameResourceInner().withUsername("sllr").withDisplayName("vdfwatkpn"), - new SenderUsernameResourceInner().withUsername("hrk").withDisplayName("iwwzjuqk"), - new SenderUsernameResourceInner().withUsername("e").withDisplayName("sonpclhocohs"), - new SenderUsernameResourceInner().withUsername("pydptko").withDisplayName("kouknvudwtiu"))) - .withNextLink("typmrbpizcdrqjsd"); - model = BinaryData.fromObject(model).toObject(SenderUsernameResourceCollection.class); - Assertions.assertEquals("sllr", model.value().get(0).username()); - Assertions.assertEquals("vdfwatkpn", model.value().get(0).displayName()); - Assertions.assertEquals("typmrbpizcdrqjsd", model.nextLink()); - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceInnerTests.java deleted file mode 100644 index 57f608a9a0d9c..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceInnerTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.SenderUsernameResourceInner; -import org.junit.jupiter.api.Assertions; - -public final class SenderUsernameResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SenderUsernameResourceInner model = BinaryData.fromString( - "{\"properties\":{\"dataLocation\":\"nfyhx\",\"username\":\"eoejzic\",\"displayName\":\"fsj\",\"provisioningState\":\"Running\"},\"id\":\"fbishcbkha\",\"name\":\"deyeamdphagalpbu\",\"type\":\"wgipwhono\"}") - .toObject(SenderUsernameResourceInner.class); - Assertions.assertEquals("eoejzic", model.username()); - Assertions.assertEquals("fsj", model.displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SenderUsernameResourceInner model - = new SenderUsernameResourceInner().withUsername("eoejzic").withDisplayName("fsj"); - model = BinaryData.fromObject(model).toObject(SenderUsernameResourceInner.class); - Assertions.assertEquals("eoejzic", model.username()); - Assertions.assertEquals("fsj", model.displayName()); - } -} 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 deleted file mode 100644 index 65044c2ed3952..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.SenderUsernameResource; -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 SenderUsernamesCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"dataLocation\":\"vqtmnub\",\"username\":\"xkp\",\"displayName\":\"smond\",\"provisioningState\":\"Creating\"},\"id\":\"xvy\",\"name\":\"omgkopkwho\",\"type\":\"v\"}"; - - 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)); - - SenderUsernameResource response = manager.senderUsernames() - .define("opcjwvnhd") - .withExistingDomain("cvkcvqvpkeqdcv", "rhvoods", "tbobz") - .withUsername("twuoegrpkhjwni") - .withDisplayName("sluicpdggkzz") - .create(); - - Assertions.assertEquals("xkp", response.username()); - Assertions.assertEquals("smond", 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 deleted file mode 100644 index eda8fdb613a3a..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.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 SenderUsernamesDeleteWithResponseMockTests { - @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("", "", AzureEnvironment.AZURE)); - - manager.senderUsernames() - .deleteWithResponse("lxyjr", "sag", "fcnihgwq", "pnedgf", 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 deleted file mode 100644 index 1c4036c7fa645..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.SenderUsernameResource; -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 SenderUsernamesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"dataLocation\":\"hfwdsjnkaljutiis\",\"username\":\"acffgdkzzewkfvhq\",\"displayName\":\"a\",\"provisioningState\":\"Updating\"},\"id\":\"n\",\"name\":\"pfuflrw\",\"type\":\"mh\"}"; - - 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)); - - SenderUsernameResource response = manager.senderUsernames() - .getWithResponse("quuvxzxcl", "ithhqzon", "sg", "b", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("acffgdkzzewkfvhq", response.username()); - Assertions.assertEquals("a", 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 deleted file mode 100644 index ee65618cbb759..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.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.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.SenderUsernameResource; -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 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\"}]}"; - - 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)); - - PagedIterable response = manager.senderUsernames() - .listByDomains("ebxmubyynt", "lrb", "tkoievseotgq", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("xbmp", response.iterator().next().username()); - Assertions.assertEquals("jefuzmuvpbttdumo", response.iterator().next().displayName()); - } -} 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 deleted file mode 100644 index 7a3e5f7a7a912..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.TaggedResource; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class TaggedResourceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TaggedResource model = BinaryData.fromString("{\"tags\":{\"pymzidnsezcxtbzs\":\"mijcmmxdcufufs\"}}") - .toObject(TaggedResource.class); - Assertions.assertEquals("mijcmmxdcufufs", model.tags().get("pymzidnsezcxtbzs")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TaggedResource model = new TaggedResource().withTags(mapOf("pymzidnsezcxtbzs", "mijcmmxdcufufs")); - model = BinaryData.fromObject(model).toObject(TaggedResource.class); - Assertions.assertEquals("mijcmmxdcufufs", model.tags().get("pymzidnsezcxtbzs")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/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 deleted file mode 100644 index 75359263d29d0..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.UpdateDomainProperties; -import com.azure.resourcemanager.communication.models.UserEngagementTracking; -import org.junit.jupiter.api.Assertions; - -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()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UpdateDomainProperties model - = new UpdateDomainProperties().withUserEngagementTracking(UserEngagementTracking.ENABLED); - model = BinaryData.fromObject(model).toObject(UpdateDomainProperties.class); - Assertions.assertEquals(UserEngagementTracking.ENABLED, 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 deleted file mode 100644 index d344abfdb83bf..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.UpdateDomainRequestParameters; -import com.azure.resourcemanager.communication.models.UserEngagementTracking; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class UpdateDomainRequestParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UpdateDomainRequestParameters model = BinaryData - .fromString( - "{\"properties\":{\"userEngagementTracking\":\"Enabled\"},\"tags\":{\"zxibqeoj\":\"ocjjxhvpmouexh\"}}") - .toObject(UpdateDomainRequestParameters.class); - Assertions.assertEquals("ocjjxhvpmouexh", model.tags().get("zxibqeoj")); - Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UpdateDomainRequestParameters model - = new UpdateDomainRequestParameters().withTags(mapOf("zxibqeoj", "ocjjxhvpmouexh")) - .withUserEngagementTracking(UserEngagementTracking.ENABLED); - model = BinaryData.fromObject(model).toObject(UpdateDomainRequestParameters.class); - Assertions.assertEquals("ocjjxhvpmouexh", model.tags().get("zxibqeoj")); - Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/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 deleted file mode 100644 index 93967146b85e8..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.UserAssignedIdentity; - -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\"}") - .toObject(UserAssignedIdentity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserAssignedIdentity model = new UserAssignedIdentity(); - model = BinaryData.fromObject(model).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 deleted file mode 100644 index 0aae65cc0da43..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.models.VerificationParameter; -import com.azure.resourcemanager.communication.models.VerificationType; -import org.junit.jupiter.api.Assertions; - -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()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VerificationParameter model = new VerificationParameter().withVerificationType(VerificationType.DKIM); - model = BinaryData.fromObject(model).toObject(VerificationParameter.class); - Assertions.assertEquals(VerificationType.DKIM, model.verificationType()); - } -}