From b0384e5280675d5b11762c15c26665c43d6aff2b Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:53:12 -0800 Subject: [PATCH] [Automation] Generate Fluent Lite from Swagger communication#package-2023-04 (#43471) --- eng/versioning/version_client.txt | 2 +- .../CHANGELOG.md | 15 +- .../README.md | 13 +- .../SAMPLE.md | 188 ++++++++------ .../pom.xml | 3 +- .../communication/CommunicationManager.java | 6 +- .../CheckNameAvailabilityResponseInner.java | 56 +++- .../models/CommunicationServiceKeysInner.java | 58 ++++- .../CommunicationServiceProperties.java | 74 +++++- .../CommunicationServiceResourceInner.java | 110 +++++++- .../CommunicationServiceUpdateProperties.java | 49 +++- .../fluent/models/DomainProperties.java | 79 +++++- .../fluent/models/DomainResourceInner.java | 104 +++++++- .../fluent/models/EmailServiceProperties.java | 55 +++- .../models/EmailServiceResourceInner.java | 104 +++++++- .../models/LinkedNotificationHubInner.java | 45 +++- .../fluent/models/OperationInner.java | 57 ++++- .../models/SenderUsernameProperties.java | 62 ++++- .../models/SenderUsernameResourceInner.java | 97 ++++++- .../fluent/models/UpdateDomainProperties.java | 47 +++- ...municationServiceManagementClientImpl.java | 3 +- .../CommunicationServicesClientImpl.java | 16 +- .../implementation/DomainsClientImpl.java | 8 +- .../EmailServicesClientImpl.java | 16 +- .../implementation/OperationsClientImpl.java | 8 +- .../implementation/ResourceManagerUtils.java | 2 - .../SenderUsernamesClientImpl.java | 12 +- .../communication/models/ActionType.java | 2 - .../models/CheckNameAvailabilityReason.java | 2 - .../models/CheckNameAvailabilityRequest.java | 49 +++- .../CommunicationServiceResourceList.java | 52 +++- .../CommunicationServiceResourceUpdate.java | 53 +++- ...ommunicationServicesProvisioningState.java | 2 - .../communication/models/DnsRecord.java | 53 +++- .../models/DomainManagement.java | 2 - .../DomainPropertiesVerificationRecords.java | 63 ++++- .../DomainPropertiesVerificationStates.java | 62 ++++- .../models/DomainResourceList.java | 51 +++- .../models/DomainsProvisioningState.java | 2 - .../models/EmailServiceResourceList.java | 51 +++- .../models/EmailServiceResourceUpdate.java | 42 ++- .../EmailServicesProvisioningState.java | 2 - .../communication/models/KeyType.java | 5 - .../models/LinkNotificationHubParameters.java | 61 ++++- .../models/ManagedServiceIdentity.java | 78 ++++-- .../models/ManagedServiceIdentityType.java | 2 - .../models/NameAvailabilityParameters.java | 44 +++- .../models/OperationDisplay.java | 65 ++++- .../models/OperationListResult.java | 52 +++- .../communication/models/Origin.java | 2 - .../models/ProvisioningState.java | 2 - .../models/RegenerateKeyParameters.java | 45 +++- .../SenderUsernameResourceCollection.java | 52 +++- .../communication/models/TaggedResource.java | 48 +++- .../models/UpdateDomainRequestParameters.java | 48 +++- .../models/UserAssignedIdentity.java | 49 +++- .../models/UserEngagementTracking.java | 2 - .../models/VerificationParameter.java | 53 +++- .../models/VerificationStatus.java | 2 - .../models/VerificationStatusRecord.java | 47 +++- .../models/VerificationType.java | 2 - .../src/main/java/module-info.java | 4 +- .../proxy-config.json | 2 +- .../reflect-config.json | 242 +----------------- ...nServicesCheckNameAvailabilitySamples.java | 12 +- ...nicationServicesCreateOrUpdateSamples.java | 15 +- .../CommunicationServicesDeleteSamples.java | 4 +- ...tionServicesGetByResourceGroupSamples.java | 5 +- ...ionServicesLinkNotificationHubSamples.java | 11 +- .../CommunicationServicesListKeysSamples.java | 4 +- ...unicationServicesRegenerateKeySamples.java | 5 +- .../CommunicationServicesUpdateSamples.java | 53 ++-- .../DomainsCancelVerificationSamples.java | 6 +- .../DomainsCreateOrUpdateSamples.java | 7 +- .../generated/DomainsDeleteSamples.java | 4 +- .../generated/DomainsGetSamples.java | 5 +- .../DomainsInitiateVerificationSamples.java | 6 +- ...ainsListByEmailServiceResourceSamples.java | 4 +- .../generated/DomainsUpdateSamples.java | 6 +- .../EmailServicesCreateOrUpdateSamples.java | 8 +- ...mailServicesGetByResourceGroupSamples.java | 5 +- .../generated/EmailServicesUpdateSamples.java | 6 +- .../SenderUsernamesCreateOrUpdateSamples.java | 7 +- .../SenderUsernamesDeleteSamples.java | 5 +- .../generated/SenderUsernamesGetSamples.java | 5 +- .../SenderUsernamesListByDomainsSamples.java | 5 +- ...ommunicationServiceResourceInnerTests.java | 2 +- ...CommunicationServiceResourceListTests.java | 2 +- ...mmunicationServiceResourceUpdateTests.java | 2 +- ...NameAvailabilityWithResponseMockTests.java | 25 +- ...cationServicesCreateOrUpdateMockTests.java | 27 +- .../CommunicationServicesDeleteMockTests.java | 25 +- ...tByResourceGroupWithResponseMockTests.java | 27 +- ...kNotificationHubWithResponseMockTests.java | 25 +- ...nServicesListByResourceGroupMockTests.java | 27 +- .../CommunicationServicesListMockTests.java | 27 +- .../generated/DomainsDeleteMockTests.java | 25 +- .../EmailServicesCreateOrUpdateMockTests.java | 25 +- .../EmailServicesDeleteMockTests.java | 25 +- ...tByResourceGroupWithResponseMockTests.java | 25 +- ...lServicesListByResourceGroupMockTests.java | 25 +- .../generated/EmailServicesListMockTests.java | 25 +- ...ngeOnlineDomainsWithResponseMockTests.java | 25 +- .../ManagedServiceIdentityTests.java | 2 +- .../generated/OperationsListMockTests.java | 25 +- ...esCreateOrUpdateWithResponseMockTests.java | 25 +- ...rUsernamesDeleteWithResponseMockTests.java | 25 +- ...nderUsernamesGetWithResponseMockTests.java | 25 +- ...SenderUsernamesListByDomainsMockTests.java | 25 +- .../generated/UserAssignedIdentityTests.java | 2 +- 110 files changed, 2268 insertions(+), 1097 deletions(-) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8dcd16b798a08..13015e6a14b00 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -312,7 +312,7 @@ com.azure.resourcemanager:azure-resourcemanager-redisenterprise;2.0.0;2.1.0-beta com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.4;1.0.0-beta.5 com.azure.resourcemanager:azure-resourcemanager-iothub;1.3.0;1.4.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-datadog;1.1.0;1.2.0-beta.1 -com.azure.resourcemanager:azure-resourcemanager-communication;2.1.0;2.2.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-communication;2.1.0;2.2.0 com.azure.resourcemanager:azure-resourcemanager-apimanagement;1.0.0-beta.5;1.0.0-beta.6 com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.1.0;1.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-changeanalysis;1.1.0;1.2.0-beta.1 diff --git a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md index 9adbd5793c75e..4b4739aca56b9 100644 --- a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md +++ b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md @@ -1,14 +1,21 @@ # Release History -## 2.2.0-beta.1 (Unreleased) +## 2.2.0 (2024-12-19) -### Features Added +- 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). ### Breaking Changes -### Bugs Fixed +#### Serialization/Deserialization change + +- `Jackson` is removed from dependency and no longer supported. + +##### Migration Guide -### Other Changes +If you are using `Jackson`/`ObjectMapper` for manual serialization/deserialization, configure your `ObjectMapper` for backward compatibility: +```java +objectMapper.registerModule(com.azure.core.serializer.json.jackson.JacksonJsonProvider.getJsonSerializableDatabindModule()); +``` ## 2.1.0 (2024-03-18) diff --git a/sdk/communication/azure-resourcemanager-communication/README.md b/sdk/communication/azure-resourcemanager-communication/README.md index cfc9dbda5c21f..a5397cfbbe104 100644 --- a/sdk/communication/azure-resourcemanager-communication/README.md +++ b/sdk/communication/azure-resourcemanager-communication/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-communication - 2.1.0 + 2.2.0 ``` [//]: # ({x-version-update-end}) @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. -- `AZURE_CLIENT_ID` for Azure client ID. -- `AZURE_TENANT_ID` for Azure tenant ID. -- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. - -With above configuration, `azure` client can be authenticated using the following code: +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -97,6 +93,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty [authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md [design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/communication/azure-resourcemanager-communication/SAMPLE.md b/sdk/communication/azure-resourcemanager-communication/SAMPLE.md index 69b2739b02863..64998b7f73e60 100644 --- a/sdk/communication/azure-resourcemanager-communication/SAMPLE.md +++ b/sdk/communication/azure-resourcemanager-communication/SAMPLE.md @@ -65,9 +65,9 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { */ public static void checkNameAvailabilityAvailable(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().checkNameAvailabilityWithResponse(new NameAvailabilityParameters() - .withName("MyCommunicationService").withType("Microsoft.Communication/CommunicationServices"), - com.azure.core.util.Context.NONE); + manager.communicationServices() + .checkNameAvailabilityWithResponse(new NameAvailabilityParameters().withName("MyCommunicationService") + .withType("Microsoft.Communication/CommunicationServices"), com.azure.core.util.Context.NONE); } /* @@ -82,9 +82,9 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { */ public static void checkNameAvailabilityUnavailable(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().checkNameAvailabilityWithResponse(new NameAvailabilityParameters() - .withName("MyCommunicationService").withType("Microsoft.Communication/CommunicationServices"), - com.azure.core.util.Context.NONE); + manager.communicationServices() + .checkNameAvailabilityWithResponse(new NameAvailabilityParameters().withName("MyCommunicationService") + .withType("Microsoft.Communication/CommunicationServices"), com.azure.core.util.Context.NONE); } } ``` @@ -110,8 +110,12 @@ public final class CommunicationServicesCreateOrUpdateSamples { * @param manager Entry point to CommunicationManager. */ public static void createOrUpdateResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().define("MyCommunicationResource").withRegion("Global") - .withExistingResourceGroup("MyResourceGroup").withDataLocation("United States").create(); + manager.communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withDataLocation("United States") + .create(); } /* @@ -126,10 +130,13 @@ public final class CommunicationServicesCreateOrUpdateSamples { */ public static void createOrUpdateResourceWithManagedIdentity( com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().define("MyCommunicationResource").withRegion("Global") + manager.communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") .withExistingResourceGroup("MyResourceGroup") .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) - .withDataLocation("United States").create(); + .withDataLocation("United States") + .create(); } } ``` @@ -152,8 +159,8 @@ public final class CommunicationServicesDeleteSamples { * @param manager Entry point to CommunicationManager. */ public static void deleteResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().delete("MyResourceGroup", "MyCommunicationResource", - com.azure.core.util.Context.NONE); + manager.communicationServices() + .delete("MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE); } } ``` @@ -176,8 +183,9 @@ public final class CommunicationServicesGetByResourceGroupSamples { * @param manager Entry point to CommunicationManager. */ public static void getResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", - com.azure.core.util.Context.NONE); + manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE); } } ``` @@ -202,11 +210,12 @@ public final class CommunicationServicesLinkNotificationHubSamples { * @param manager Entry point to CommunicationManager. */ public static void linkNotificationHub(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().linkNotificationHubWithResponse("MyResourceGroup", "MyCommunicationResource", - new LinkNotificationHubParameters().withResourceId( - "/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/notificationHubs/MyHub") - .withConnectionString("Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234"), - com.azure.core.util.Context.NONE); + manager.communicationServices() + .linkNotificationHubWithResponse("MyResourceGroup", "MyCommunicationResource", + new LinkNotificationHubParameters().withResourceId( + "/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/notificationHubs/MyHub") + .withConnectionString("Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234"), + com.azure.core.util.Context.NONE); } } ``` @@ -275,8 +284,8 @@ public final class CommunicationServicesListKeysSamples { * @param manager Entry point to CommunicationManager. */ public static void listKeys(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().listKeysWithResponse("MyResourceGroup", "MyCommunicationResource", - com.azure.core.util.Context.NONE); + manager.communicationServices() + .listKeysWithResponse("MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE); } } ``` @@ -302,8 +311,9 @@ public final class CommunicationServicesRegenerateKeySamples { * @param manager Entry point to CommunicationManager. */ public static void regenerateKey(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().regenerateKeyWithResponse("MyResourceGroup", "MyCommunicationResource", - new RegenerateKeyParameters().withKeyType(KeyType.PRIMARY), com.azure.core.util.Context.NONE); + manager.communicationServices() + .regenerateKeyWithResponse("MyResourceGroup", "MyCommunicationResource", + new RegenerateKeyParameters().withKeyType(KeyType.PRIMARY), com.azure.core.util.Context.NONE); } } ``` @@ -333,9 +343,10 @@ public final class CommunicationServicesUpdateSamples { * @param manager Entry point to CommunicationManager. */ public static void updateResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("newTag", "newVal")).apply(); } @@ -351,10 +362,12 @@ public final class CommunicationServicesUpdateSamples { */ public static void updateResourceToAddAUserAssignedManagedIdentity( com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); - resource.update().withTags(mapOf("newTag", "newVal")) + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) .withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity()))) .apply(); @@ -372,11 +385,14 @@ public final class CommunicationServicesUpdateSamples { */ public static void updateResourceToAddASystemAssignedManagedIdentity( com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); - resource.update().withTags(mapOf("newTag", "newVal")) - .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)).apply(); + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .apply(); } /* @@ -391,11 +407,14 @@ public final class CommunicationServicesUpdateSamples { */ public static void updateResourceToRemoveIdentity(com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); - resource.update().withTags(mapOf("newTag", "newVal")) - .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply(); + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)) + .apply(); } /* @@ -410,10 +429,12 @@ public final class CommunicationServicesUpdateSamples { */ public static void updateResourceToAddSystemAndUserManagedIdentities( com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); - resource.update().withTags(mapOf("newTag", "newVal")) + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) .withIdentity( new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) .withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity()))) @@ -455,8 +476,10 @@ public final class DomainsCancelVerificationSamples { * @param manager Entry point to CommunicationManager. */ public static void cancelVerification(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().cancelVerification("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - new VerificationParameter().withVerificationType(VerificationType.SPF), com.azure.core.util.Context.NONE); + manager.domains() + .cancelVerification("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + new VerificationParameter().withVerificationType(VerificationType.SPF), + com.azure.core.util.Context.NONE); } } ``` @@ -482,9 +505,12 @@ public final class DomainsCreateOrUpdateSamples { */ public static void createOrUpdateDomainsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().define("mydomain.com").withRegion("Global") + manager.domains() + .define("mydomain.com") + .withRegion("Global") .withExistingEmailService("MyResourceGroup", "MyEmailServiceResource") - .withDomainManagement(DomainManagement.CUSTOMER_MANAGED).create(); + .withDomainManagement(DomainManagement.CUSTOMER_MANAGED) + .create(); } } ``` @@ -507,8 +533,8 @@ public final class DomainsDeleteSamples { * @param manager Entry point to CommunicationManager. */ public static void deleteDomainsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().delete("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - com.azure.core.util.Context.NONE); + manager.domains() + .delete("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", com.azure.core.util.Context.NONE); } } ``` @@ -530,8 +556,9 @@ public final class DomainsGetSamples { * @param manager Entry point to CommunicationManager. */ public static void getDomainsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().getWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - com.azure.core.util.Context.NONE); + manager.domains() + .getWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + com.azure.core.util.Context.NONE); } } ``` @@ -557,8 +584,10 @@ public final class DomainsInitiateVerificationSamples { * @param manager Entry point to CommunicationManager. */ public static void initiateVerification(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().initiateVerification("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - new VerificationParameter().withVerificationType(VerificationType.SPF), com.azure.core.util.Context.NONE); + manager.domains() + .initiateVerification("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + new VerificationParameter().withVerificationType(VerificationType.SPF), + com.azure.core.util.Context.NONE); } } ``` @@ -582,8 +611,8 @@ public final class DomainsListByEmailServiceResourceSamples { */ public static void listDomainsResourcesByEmailServiceName(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().listByEmailServiceResource("MyResourceGroup", "MyEmailServiceResource", - com.azure.core.util.Context.NONE); + manager.domains() + .listByEmailServiceResource("MyResourceGroup", "MyEmailServiceResource", com.azure.core.util.Context.NONE); } } ``` @@ -609,8 +638,10 @@ public final class DomainsUpdateSamples { * @param manager Entry point to CommunicationManager. */ public static void updateDomainsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - DomainResource resource = manager.domains().getWithResponse("MyResourceGroup", "MyEmailServiceResource", - "mydomain.com", com.azure.core.util.Context.NONE).getValue(); + DomainResource resource = manager.domains() + .getWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().withUserEngagementTracking(UserEngagementTracking.ENABLED).apply(); } } @@ -635,8 +666,12 @@ public final class EmailServicesCreateOrUpdateSamples { */ public static void createOrUpdateEmailServiceResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.emailServices().define("MyEmailServiceResource").withRegion("Global") - .withExistingResourceGroup("MyResourceGroup").withDataLocation("United States").create(); + manager.emailServices() + .define("MyEmailServiceResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withDataLocation("United States") + .create(); } } ``` @@ -683,8 +718,9 @@ public final class EmailServicesGetByResourceGroupSamples { * @param manager Entry point to CommunicationManager. */ public static void getEmailServiceResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.emailServices().getByResourceGroupWithResponse("MyResourceGroup", "MyEmailServiceResource", - com.azure.core.util.Context.NONE); + manager.emailServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyEmailServiceResource", + com.azure.core.util.Context.NONE); } } ``` @@ -784,8 +820,10 @@ public final class EmailServicesUpdateSamples { */ public static void updateEmailServiceResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - EmailServiceResource resource = manager.emailServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyEmailServiceResource", com.azure.core.util.Context.NONE).getValue(); + EmailServiceResource resource = manager.emailServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyEmailServiceResource", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("newTag", "newVal")).apply(); } @@ -845,9 +883,12 @@ public final class SenderUsernamesCreateOrUpdateSamples { */ public static void createOrUpdateSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.senderUsernames().define("contosoNewsAlerts") + manager.senderUsernames() + .define("contosoNewsAlerts") .withExistingDomain("contosoResourceGroup", "contosoEmailService", "contoso.com") - .withUsername("contosoNewsAlerts").withDisplayName("Contoso News Alerts").create(); + .withUsername("contosoNewsAlerts") + .withDisplayName("Contoso News Alerts") + .create(); } } ``` @@ -871,8 +912,9 @@ public final class SenderUsernamesDeleteSamples { */ public static void deleteSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.senderUsernames().deleteWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - "contosoNewsAlerts", com.azure.core.util.Context.NONE); + manager.senderUsernames() + .deleteWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", "contosoNewsAlerts", + com.azure.core.util.Context.NONE); } } ``` @@ -896,8 +938,9 @@ public final class SenderUsernamesGetSamples { */ public static void getSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.senderUsernames().getWithResponse("contosoResourceGroup", "contosoEmailService", "contoso.com", - "contosoNewsAlerts", com.azure.core.util.Context.NONE); + manager.senderUsernames() + .getWithResponse("contosoResourceGroup", "contosoEmailService", "contoso.com", "contosoNewsAlerts", + com.azure.core.util.Context.NONE); } } ``` @@ -921,8 +964,9 @@ public final class SenderUsernamesListByDomainsSamples { */ public static void getSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.senderUsernames().listByDomains("contosoResourceGroup", "contosoEmailService", "contoso.com", - com.azure.core.util.Context.NONE); + manager.senderUsernames() + .listByDomains("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 a3b5477be7a8a..63ee265e9b4c0 100644 --- a/sdk/communication/azure-resourcemanager-communication/pom.xml +++ b/sdk/communication/azure-resourcemanager-communication/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-communication - 2.2.0-beta.1 + 2.2.0 jar Microsoft Azure SDK for Communication Management @@ -45,6 +45,7 @@ UTF-8 0 0 + false diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java index 97b9861d9ab75..d39d141f3e315 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 @@ -11,6 +11,7 @@ import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -19,7 +20,6 @@ import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -221,7 +221,7 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil .append("-") .append("com.azure.resourcemanager.communication") .append("/") - .append("2.1.0"); + .append("2.2.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -254,7 +254,7 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .collect(Collectors.toList())); diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CheckNameAvailabilityResponseInner.java index dd502392611a4..33e43761fe6e7 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CheckNameAvailabilityResponseInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CheckNameAvailabilityResponseInner.java @@ -5,30 +5,31 @@ 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 com.azure.resourcemanager.communication.models.CheckNameAvailabilityReason; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The check availability result. */ @Fluent -public final class CheckNameAvailabilityResponseInner { +public final class CheckNameAvailabilityResponseInner implements JsonSerializable { /* * Indicates if the resource name is available. */ - @JsonProperty(value = "nameAvailable") private Boolean nameAvailable; /* * The reason why the given name is not available. */ - @JsonProperty(value = "reason") private CheckNameAvailabilityReason reason; /* * Detailed reason why the given name is available. */ - @JsonProperty(value = "message") private String message; /** @@ -104,4 +105,49 @@ public CheckNameAvailabilityResponseInner withMessage(String message) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable); + jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString()); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityResponseInner 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 CheckNameAvailabilityResponseInner. + */ + public static CheckNameAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityResponseInner deserializedCheckNameAvailabilityResponseInner + = new CheckNameAvailabilityResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.reason + = CheckNameAvailabilityReason.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityResponseInner; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceKeysInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceKeysInner.java index 77f0c4ca28b06..7e04cf94bce18 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceKeysInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceKeysInner.java @@ -5,35 +5,35 @@ package com.azure.resourcemanager.communication.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +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 representing the access keys of a CommunicationService. */ @Fluent -public final class CommunicationServiceKeysInner { +public final class CommunicationServiceKeysInner implements JsonSerializable { /* * The primary access key. */ - @JsonProperty(value = "primaryKey") private String primaryKey; /* * The secondary access key. */ - @JsonProperty(value = "secondaryKey") private String secondaryKey; /* * CommunicationService connection string constructed via the primaryKey */ - @JsonProperty(value = "primaryConnectionString") private String primaryConnectionString; /* * CommunicationService connection string constructed via the secondaryKey */ - @JsonProperty(value = "secondaryConnectionString") private String secondaryConnectionString; /** @@ -131,4 +131,50 @@ public CommunicationServiceKeysInner withSecondaryConnectionString(String second */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("primaryKey", this.primaryKey); + jsonWriter.writeStringField("secondaryKey", this.secondaryKey); + jsonWriter.writeStringField("primaryConnectionString", this.primaryConnectionString); + jsonWriter.writeStringField("secondaryConnectionString", this.secondaryConnectionString); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunicationServiceKeysInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunicationServiceKeysInner 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 CommunicationServiceKeysInner. + */ + public static CommunicationServiceKeysInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunicationServiceKeysInner deserializedCommunicationServiceKeysInner + = new CommunicationServiceKeysInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("primaryKey".equals(fieldName)) { + deserializedCommunicationServiceKeysInner.primaryKey = reader.getString(); + } else if ("secondaryKey".equals(fieldName)) { + deserializedCommunicationServiceKeysInner.secondaryKey = reader.getString(); + } else if ("primaryConnectionString".equals(fieldName)) { + deserializedCommunicationServiceKeysInner.primaryConnectionString = reader.getString(); + } else if ("secondaryConnectionString".equals(fieldName)) { + deserializedCommunicationServiceKeysInner.secondaryConnectionString = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunicationServiceKeysInner; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceProperties.java index 4f247e33fc6b4..d85a8701fdf17 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceProperties.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceProperties.java @@ -6,55 +6,52 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.CommunicationServicesProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * A class that describes the properties of the CommunicationService. */ @Fluent -public final class CommunicationServiceProperties { +public final class CommunicationServiceProperties implements JsonSerializable { /* * Provisioning state of the resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private CommunicationServicesProvisioningState provisioningState; /* * FQDN of the CommunicationService instance. */ - @JsonProperty(value = "hostName", access = JsonProperty.Access.WRITE_ONLY) private String hostname; /* * The location where the communication service stores its data at rest. */ - @JsonProperty(value = "dataLocation", required = true) private String dataLocation; /* * Resource ID of an Azure Notification Hub linked to this resource. */ - @JsonProperty(value = "notificationHubId", access = JsonProperty.Access.WRITE_ONLY) private String notificationHubId; /* * Version of the CommunicationService resource. Probably you need the same or higher version of client SDKs. */ - @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) private String version; /* * The immutable resource Id of the communication service. */ - @JsonProperty(value = "immutableResourceId", access = JsonProperty.Access.WRITE_ONLY) private String immutableResourceId; /* * List of email Domain resource Ids. */ - @JsonProperty(value = "linkedDomains") private List linkedDomains; /** @@ -156,10 +153,65 @@ public CommunicationServiceProperties withLinkedDomains(List linkedDomai */ public void validate() { if (dataLocation() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property dataLocation in model CommunicationServiceProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataLocation in model CommunicationServiceProperties")); } } private static final ClientLogger LOGGER = new ClientLogger(CommunicationServiceProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataLocation", this.dataLocation); + jsonWriter.writeArrayField("linkedDomains", this.linkedDomains, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunicationServiceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunicationServiceProperties 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 CommunicationServiceProperties. + */ + public static CommunicationServiceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunicationServiceProperties deserializedCommunicationServiceProperties + = new CommunicationServiceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataLocation".equals(fieldName)) { + deserializedCommunicationServiceProperties.dataLocation = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedCommunicationServiceProperties.provisioningState + = CommunicationServicesProvisioningState.fromString(reader.getString()); + } else if ("hostName".equals(fieldName)) { + deserializedCommunicationServiceProperties.hostname = reader.getString(); + } else if ("notificationHubId".equals(fieldName)) { + deserializedCommunicationServiceProperties.notificationHubId = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedCommunicationServiceProperties.version = reader.getString(); + } else if ("immutableResourceId".equals(fieldName)) { + deserializedCommunicationServiceProperties.immutableResourceId = reader.getString(); + } else if ("linkedDomains".equals(fieldName)) { + List linkedDomains = reader.readArray(reader1 -> reader1.getString()); + deserializedCommunicationServiceProperties.linkedDomains = linkedDomains; + } else { + reader.skipChildren(); + } + } + + return deserializedCommunicationServiceProperties; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java index b2091975b8e55..c836ea5a7be43 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java @@ -7,9 +7,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.CommunicationServicesProvisioningState; import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -21,21 +24,33 @@ public final class CommunicationServiceResourceInner extends Resource { /* * The properties of the service. */ - @JsonProperty(value = "properties") private CommunicationServiceProperties innerProperties; /* * Managed service identity (system assigned and/or user assigned identities) */ - @JsonProperty(value = "identity") private ManagedServiceIdentity identity; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) 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 CommunicationServiceResourceInner class. */ @@ -80,6 +95,36 @@ 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; + } + /** * {@inheritDoc} */ @@ -203,4 +248,61 @@ public void validate() { identity().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunicationServiceResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunicationServiceResourceInner 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 CommunicationServiceResourceInner. + */ + public static CommunicationServiceResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunicationServiceResourceInner deserializedCommunicationServiceResourceInner + = new CommunicationServiceResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCommunicationServiceResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCommunicationServiceResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCommunicationServiceResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCommunicationServiceResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCommunicationServiceResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCommunicationServiceResourceInner.innerProperties + = CommunicationServiceProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedCommunicationServiceResourceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCommunicationServiceResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunicationServiceResourceInner; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceUpdateProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceUpdateProperties.java index 8971250f1474c..c388a026582d8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceUpdateProperties.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceUpdateProperties.java @@ -5,18 +5,22 @@ package com.azure.resourcemanager.communication.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * A class that describes the properties that can be updated for CommunicationService resource. */ @Fluent -public final class CommunicationServiceUpdateProperties { +public final class CommunicationServiceUpdateProperties + implements JsonSerializable { /* * List of email Domain resource Ids. */ - @JsonProperty(value = "linkedDomains") private List linkedDomains; /** @@ -52,4 +56,43 @@ public CommunicationServiceUpdateProperties withLinkedDomains(List linke */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("linkedDomains", this.linkedDomains, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunicationServiceUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunicationServiceUpdateProperties 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 CommunicationServiceUpdateProperties. + */ + public static CommunicationServiceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunicationServiceUpdateProperties deserializedCommunicationServiceUpdateProperties + = new CommunicationServiceUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("linkedDomains".equals(fieldName)) { + List linkedDomains = reader.readArray(reader1 -> reader1.getString()); + deserializedCommunicationServiceUpdateProperties.linkedDomains = linkedDomains; + } else { + reader.skipChildren(); + } + } + + return deserializedCommunicationServiceUpdateProperties; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/DomainProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/DomainProperties.java index 47edeb9bf8ec7..65c08f3c9020a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/DomainProperties.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/DomainProperties.java @@ -6,64 +6,60 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.DomainManagement; import com.azure.resourcemanager.communication.models.DomainPropertiesVerificationRecords; import com.azure.resourcemanager.communication.models.DomainPropertiesVerificationStates; import com.azure.resourcemanager.communication.models.DomainsProvisioningState; import com.azure.resourcemanager.communication.models.UserEngagementTracking; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * A class that describes the properties of a Domains resource. */ @Fluent -public final class DomainProperties { +public final class DomainProperties implements JsonSerializable { /* * Provisioning state of the resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private DomainsProvisioningState provisioningState; /* * The location where the Domains resource data is stored at rest. */ - @JsonProperty(value = "dataLocation", access = JsonProperty.Access.WRITE_ONLY) private String dataLocation; /* * P2 sender domain that is displayed to the email recipients [RFC 5322]. */ - @JsonProperty(value = "fromSenderDomain", access = JsonProperty.Access.WRITE_ONLY) private String fromSenderDomain; /* * P1 sender domain that is present on the email envelope [RFC 5321]. */ - @JsonProperty(value = "mailFromSenderDomain", access = JsonProperty.Access.WRITE_ONLY) private String mailFromSenderDomain; /* * Describes how a Domains resource is being managed. */ - @JsonProperty(value = "domainManagement", required = true) private DomainManagement domainManagement; /* * List of VerificationStatusRecord */ - @JsonProperty(value = "verificationStates", access = JsonProperty.Access.WRITE_ONLY) private DomainPropertiesVerificationStates verificationStates; /* * List of DnsRecord */ - @JsonProperty(value = "verificationRecords", access = JsonProperty.Access.WRITE_ONLY) private DomainPropertiesVerificationRecords verificationRecords; /* * Describes whether user engagement tracking is enabled or disabled. */ - @JsonProperty(value = "userEngagementTracking") private UserEngagementTracking userEngagementTracking; /** @@ -173,8 +169,9 @@ public DomainProperties withUserEngagementTracking(UserEngagementTracking userEn */ public void validate() { if (domainManagement() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property domainManagement in model DomainProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property domainManagement in model DomainProperties")); } if (verificationStates() != null) { verificationStates().validate(); @@ -185,4 +182,62 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(DomainProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("domainManagement", + this.domainManagement == null ? null : this.domainManagement.toString()); + jsonWriter.writeStringField("userEngagementTracking", + this.userEngagementTracking == null ? null : this.userEngagementTracking.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DomainProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DomainProperties 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 DomainProperties. + */ + public static DomainProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DomainProperties deserializedDomainProperties = new DomainProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("domainManagement".equals(fieldName)) { + deserializedDomainProperties.domainManagement = DomainManagement.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedDomainProperties.provisioningState + = DomainsProvisioningState.fromString(reader.getString()); + } else if ("dataLocation".equals(fieldName)) { + deserializedDomainProperties.dataLocation = reader.getString(); + } else if ("fromSenderDomain".equals(fieldName)) { + deserializedDomainProperties.fromSenderDomain = reader.getString(); + } else if ("mailFromSenderDomain".equals(fieldName)) { + deserializedDomainProperties.mailFromSenderDomain = reader.getString(); + } else if ("verificationStates".equals(fieldName)) { + deserializedDomainProperties.verificationStates + = DomainPropertiesVerificationStates.fromJson(reader); + } else if ("verificationRecords".equals(fieldName)) { + deserializedDomainProperties.verificationRecords + = DomainPropertiesVerificationRecords.fromJson(reader); + } else if ("userEngagementTracking".equals(fieldName)) { + deserializedDomainProperties.userEngagementTracking + = UserEngagementTracking.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDomainProperties; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/DomainResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/DomainResourceInner.java index 27de76ac5c107..6d252b27b0e16 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/DomainResourceInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/DomainResourceInner.java @@ -7,12 +7,15 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.DomainManagement; import com.azure.resourcemanager.communication.models.DomainPropertiesVerificationRecords; import com.azure.resourcemanager.communication.models.DomainPropertiesVerificationStates; import com.azure.resourcemanager.communication.models.DomainsProvisioningState; import com.azure.resourcemanager.communication.models.UserEngagementTracking; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -23,15 +26,28 @@ public final class DomainResourceInner extends Resource { /* * The properties of a Domains resource. */ - @JsonProperty(value = "properties") private DomainProperties innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) 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 DomainResourceInner class. */ @@ -56,6 +72,36 @@ 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; + } + /** * {@inheritDoc} */ @@ -184,4 +230,56 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DomainResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DomainResourceInner 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 DomainResourceInner. + */ + public static DomainResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DomainResourceInner deserializedDomainResourceInner = new DomainResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDomainResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDomainResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDomainResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDomainResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDomainResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedDomainResourceInner.innerProperties = DomainProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDomainResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDomainResourceInner; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/EmailServiceProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/EmailServiceProperties.java index 9b383a724b55e..8488570ce696f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/EmailServiceProperties.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/EmailServiceProperties.java @@ -6,24 +6,26 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.EmailServicesProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * A class that describes the properties of the EmailService. */ @Fluent -public final class EmailServiceProperties { +public final class EmailServiceProperties implements JsonSerializable { /* * Provisioning state of the resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private EmailServicesProvisioningState provisioningState; /* * The location where the email service stores its data at rest. */ - @JsonProperty(value = "dataLocation", required = true) private String dataLocation; /** @@ -68,10 +70,51 @@ public EmailServiceProperties withDataLocation(String dataLocation) { */ public void validate() { if (dataLocation() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property dataLocation in model EmailServiceProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataLocation in model EmailServiceProperties")); } } private static final ClientLogger LOGGER = new ClientLogger(EmailServiceProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataLocation", this.dataLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EmailServiceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EmailServiceProperties 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 EmailServiceProperties. + */ + public static EmailServiceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EmailServiceProperties deserializedEmailServiceProperties = new EmailServiceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataLocation".equals(fieldName)) { + deserializedEmailServiceProperties.dataLocation = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedEmailServiceProperties.provisioningState + = EmailServicesProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEmailServiceProperties; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/EmailServiceResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/EmailServiceResourceInner.java index 104d98df8b0a6..f292be46b98e7 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/EmailServiceResourceInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/EmailServiceResourceInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.EmailServicesProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -19,15 +22,28 @@ public final class EmailServiceResourceInner extends Resource { /* * The properties of the service. */ - @JsonProperty(value = "properties") private EmailServiceProperties innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) 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 EmailServiceResourceInner class. */ @@ -52,6 +68,36 @@ 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; + } + /** * {@inheritDoc} */ @@ -112,4 +158,56 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EmailServiceResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EmailServiceResourceInner 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 EmailServiceResourceInner. + */ + public static EmailServiceResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EmailServiceResourceInner deserializedEmailServiceResourceInner = new EmailServiceResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEmailServiceResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEmailServiceResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEmailServiceResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedEmailServiceResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEmailServiceResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedEmailServiceResourceInner.innerProperties = EmailServiceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedEmailServiceResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEmailServiceResourceInner; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/LinkedNotificationHubInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/LinkedNotificationHubInner.java index efc241c9e8ec4..f597c24b96fae 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/LinkedNotificationHubInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/LinkedNotificationHubInner.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.communication.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +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 notification hub that has been linked to the communication service. */ @Fluent -public final class LinkedNotificationHubInner { +public final class LinkedNotificationHubInner implements JsonSerializable { /* * The resource ID of the notification hub */ - @JsonProperty(value = "resourceId") private String resourceId; /** @@ -51,4 +54,40 @@ public LinkedNotificationHubInner withResourceId(String resourceId) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceId", this.resourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinkedNotificationHubInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinkedNotificationHubInner 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 LinkedNotificationHubInner. + */ + public static LinkedNotificationHubInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinkedNotificationHubInner deserializedLinkedNotificationHubInner = new LinkedNotificationHubInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceId".equals(fieldName)) { + deserializedLinkedNotificationHubInner.resourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLinkedNotificationHubInner; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java index 4812ed216e9eb..b665bcba7abb6 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java @@ -5,10 +5,14 @@ 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 com.azure.resourcemanager.communication.models.ActionType; import com.azure.resourcemanager.communication.models.OperationDisplay; import com.azure.resourcemanager.communication.models.Origin; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * REST API Operation @@ -16,38 +20,33 @@ * Details of a REST API operation, returned from the Resource Provider Operations API. */ @Fluent -public final class OperationInner { +public final class OperationInner implements JsonSerializable { /* * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for * ARM/control-plane operations. */ - @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) private Boolean isDataAction; /* * Localized display information for this particular operation. */ - @JsonProperty(value = "display") private OperationDisplay display; /* * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default * value is "user,system" */ - @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) private Origin origin; /* * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ - @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) private ActionType actionType; /** @@ -126,4 +125,48 @@ public void validate() { display().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner 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 OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SenderUsernameProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SenderUsernameProperties.java index 4370c1c0e7bec..dfc602316893a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SenderUsernameProperties.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SenderUsernameProperties.java @@ -6,36 +6,36 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * A class that describes the properties of a SenderUsername resource. */ @Fluent -public final class SenderUsernameProperties { +public final class SenderUsernameProperties implements JsonSerializable { /* * The location where the SenderUsername resource data is stored at rest. */ - @JsonProperty(value = "dataLocation", access = JsonProperty.Access.WRITE_ONLY) private String dataLocation; /* * A sender senderUsername to be used when sending emails. */ - @JsonProperty(value = "username", required = true) private String username; /* * The display name for the senderUsername. */ - @JsonProperty(value = "displayName") private String displayName; /* * Provisioning state of the resource. Unknown is the default state for Communication Services. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -110,10 +110,56 @@ public ProvisioningState provisioningState() { */ public void validate() { if (username() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property username in model SenderUsernameProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property username in model SenderUsernameProperties")); } } private static final ClientLogger LOGGER = new ClientLogger(SenderUsernameProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("username", this.username); + jsonWriter.writeStringField("displayName", this.displayName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SenderUsernameProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SenderUsernameProperties 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 SenderUsernameProperties. + */ + public static SenderUsernameProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SenderUsernameProperties deserializedSenderUsernameProperties = new SenderUsernameProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("username".equals(fieldName)) { + deserializedSenderUsernameProperties.username = reader.getString(); + } else if ("dataLocation".equals(fieldName)) { + deserializedSenderUsernameProperties.dataLocation = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedSenderUsernameProperties.displayName = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedSenderUsernameProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSenderUsernameProperties; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SenderUsernameResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SenderUsernameResourceInner.java index 6070df727b1cb..79b65b14832b3 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SenderUsernameResourceInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/SenderUsernameResourceInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * A class representing a SenderUsername resource. @@ -18,15 +21,28 @@ public final class SenderUsernameResourceInner extends ProxyResource { /* * The properties of a SenderUsername resource. */ - @JsonProperty(value = "properties") private SenderUsernameProperties innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) 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 SenderUsernameResourceInner class. */ @@ -51,6 +67,36 @@ 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 dataLocation property: The location where the SenderUsername resource data is stored at rest. * @@ -126,4 +172,49 @@ public void validate() { 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 SenderUsernameResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SenderUsernameResourceInner 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 SenderUsernameResourceInner. + */ + public static SenderUsernameResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SenderUsernameResourceInner deserializedSenderUsernameResourceInner = new SenderUsernameResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSenderUsernameResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSenderUsernameResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSenderUsernameResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSenderUsernameResourceInner.innerProperties = SenderUsernameProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSenderUsernameResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSenderUsernameResourceInner; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/UpdateDomainProperties.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/UpdateDomainProperties.java index 602c921c12d4d..16f865e68e86f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/UpdateDomainProperties.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/UpdateDomainProperties.java @@ -5,18 +5,21 @@ 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 com.azure.resourcemanager.communication.models.UserEngagementTracking; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * A class that describes the updatable properties of a Domains resource. */ @Fluent -public final class UpdateDomainProperties { +public final class UpdateDomainProperties implements JsonSerializable { /* * Describes whether user engagement tracking is enabled or disabled. */ - @JsonProperty(value = "userEngagementTracking") private UserEngagementTracking userEngagementTracking; /** @@ -52,4 +55,42 @@ public UpdateDomainProperties withUserEngagementTracking(UserEngagementTracking */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("userEngagementTracking", + this.userEngagementTracking == null ? null : this.userEngagementTracking.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateDomainProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateDomainProperties 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 UpdateDomainProperties. + */ + public static UpdateDomainProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateDomainProperties deserializedUpdateDomainProperties = new UpdateDomainProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userEngagementTracking".equals(fieldName)) { + deserializedUpdateDomainProperties.userEngagementTracking + = UserEngagementTracking.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateDomainProperties; + }); + } } 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 b7c7e971e6d23..ce3b59febe14d 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 @@ -5,6 +5,7 @@ package com.azure.resourcemanager.communication.implementation; import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; @@ -323,7 +324,7 @@ public int getStatusCode() { } public String getHeaderValue(String s) { - return httpHeaders.getValue(s); + return httpHeaders.getValue(HttpHeaderName.fromString(s)); } public HttpHeaders getHeaders() { diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java index fefdf0384a7d6..1a199f612113a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java @@ -1799,9 +1799,7 @@ public CommunicationServiceKeysInner regenerateKey(String resourceGroupName, Str /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. @@ -1830,9 +1828,7 @@ public CommunicationServiceKeysInner regenerateKey(String resourceGroupName, Str /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. @@ -1860,9 +1856,7 @@ public CommunicationServiceKeysInner regenerateKey(String resourceGroupName, Str /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. @@ -1891,9 +1885,7 @@ public CommunicationServiceKeysInner regenerateKey(String resourceGroupName, Str /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainsClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainsClientImpl.java index a2fb2d1caa9a7..500bcf446c70c 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainsClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/DomainsClientImpl.java @@ -1804,9 +1804,7 @@ public void cancelVerification(String resourceGroupName, String emailServiceName /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. @@ -1834,9 +1832,7 @@ private Mono> listByEmailServiceResourceNextS /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServicesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServicesClientImpl.java index d6706e13eb218..0fc971e7ad12e 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServicesClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/EmailServicesClientImpl.java @@ -1396,9 +1396,7 @@ public List listVerifiedExchangeOnlineDomains() { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. @@ -1426,9 +1424,7 @@ private Mono> listBySubscriptionNextSin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. @@ -1456,9 +1452,7 @@ private Mono> listBySubscriptionNextSin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. @@ -1486,9 +1480,7 @@ private Mono> listByResourceGroupNextSi /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java index 15abcb2f9432b..8002773a39b59 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java @@ -195,9 +195,7 @@ public PagedIterable list(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. @@ -223,9 +221,7 @@ private Mono> listNextSinglePageAsync(String nextL /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/ResourceManagerUtils.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/ResourceManagerUtils.java index 31004fac799fa..e8a23516f4442 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/ResourceManagerUtils.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/ResourceManagerUtils.java @@ -41,7 +41,6 @@ static String getValueFromIdByName(String id, String name) { } } return null; - } static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { @@ -75,7 +74,6 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } } return null; - } static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SenderUsernamesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SenderUsernamesClientImpl.java index ebcb9fa7a9d72..ee4400957264b 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SenderUsernamesClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/SenderUsernamesClientImpl.java @@ -59,8 +59,8 @@ public final class SenderUsernamesClientImpl implements SenderUsernamesClient { } /** - * The interface defining all the services for CommunicationServiceManagementClientSenderUsernames to be used by - * the proxy service to perform REST calls. + * The interface defining all the services for CommunicationServiceManagementClientSenderUsernames to be used by the + * proxy service to perform REST calls. */ @Host("{$host}") @ServiceInterface(name = "CommunicationService") @@ -787,9 +787,7 @@ public void delete(String resourceGroupName, String emailServiceName, String dom /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. @@ -816,9 +814,7 @@ private Mono> listByDomainsNextSingle /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @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. diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ActionType.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ActionType.java index 101a3ac9aa0b5..571f690efb5d2 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ActionType.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ActionType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public ActionType() { * @param name a name to look for. * @return the corresponding ActionType. */ - @JsonCreator public static ActionType fromString(String name) { return fromString(name, ActionType.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CheckNameAvailabilityReason.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CheckNameAvailabilityReason.java index 9e22e428b1a46..fe52ea4b9a71c 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CheckNameAvailabilityReason.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CheckNameAvailabilityReason.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public CheckNameAvailabilityReason() { * @param name a name to look for. * @return the corresponding CheckNameAvailabilityReason. */ - @JsonCreator public static CheckNameAvailabilityReason fromString(String name) { return fromString(name, CheckNameAvailabilityReason.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CheckNameAvailabilityRequest.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CheckNameAvailabilityRequest.java index 8cadf77be84d7..4fddbfb8b98fc 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CheckNameAvailabilityRequest.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CheckNameAvailabilityRequest.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The check availability request body. */ @Fluent -public class CheckNameAvailabilityRequest { +public class CheckNameAvailabilityRequest implements JsonSerializable { /* * The name of the resource for which availability needs to be checked. */ - @JsonProperty(value = "name") private String name; /* * The resource type. */ - @JsonProperty(value = "type") private String type; /** @@ -77,4 +79,43 @@ public CheckNameAvailabilityRequest withType(String type) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityRequest 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 CheckNameAvailabilityRequest. + */ + public static CheckNameAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityRequest deserializedCheckNameAvailabilityRequest = new CheckNameAvailabilityRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityRequest; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceList.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceList.java index 2d15a83db059c..4ea9733fbc5dc 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceList.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceList.java @@ -5,26 +5,28 @@ 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.CommunicationServiceResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Object that includes an array of CommunicationServices and a possible link for next set. */ @Fluent -public final class CommunicationServiceResourceList { +public final class CommunicationServiceResourceList implements JsonSerializable { /* * List of CommunicationService */ - @JsonProperty(value = "value") private List value; /* * The URL the client should use to fetch the next page (per server side paging). * It's null for now, added for future use. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -85,4 +87,46 @@ public void validate() { 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 CommunicationServiceResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunicationServiceResourceList 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 CommunicationServiceResourceList. + */ + public static CommunicationServiceResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunicationServiceResourceList deserializedCommunicationServiceResourceList + = new CommunicationServiceResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CommunicationServiceResourceInner.fromJson(reader1)); + deserializedCommunicationServiceResourceList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCommunicationServiceResourceList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunicationServiceResourceList; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java index 84cca0c190a55..09e480267ef7c 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceUpdateProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -18,13 +21,11 @@ public final class CommunicationServiceResourceUpdate extends TaggedResource { /* * The properties of the service. */ - @JsonProperty(value = "properties") private CommunicationServiceUpdateProperties innerProperties; /* * Managed service identity (system assigned and/or user assigned identities) */ - @JsonProperty(value = "identity") private ManagedServiceIdentity identity; /** @@ -101,7 +102,6 @@ public CommunicationServiceResourceUpdate withLinkedDomains(List linkedD */ @Override public void validate() { - super.validate(); if (innerProperties() != null) { innerProperties().validate(); } @@ -109,4 +109,49 @@ public void validate() { identity().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunicationServiceResourceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunicationServiceResourceUpdate 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 CommunicationServiceResourceUpdate. + */ + public static CommunicationServiceResourceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunicationServiceResourceUpdate deserializedCommunicationServiceResourceUpdate + = new CommunicationServiceResourceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCommunicationServiceResourceUpdate.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCommunicationServiceResourceUpdate.innerProperties + = CommunicationServiceUpdateProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedCommunicationServiceResourceUpdate.identity = ManagedServiceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunicationServiceResourceUpdate; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesProvisioningState.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesProvisioningState.java index 4d0a81ed9a3f5..83fee788b2075 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesProvisioningState.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -73,7 +72,6 @@ public CommunicationServicesProvisioningState() { * @param name a name to look for. * @return the corresponding CommunicationServicesProvisioningState. */ - @JsonCreator public static CommunicationServicesProvisioningState fromString(String name) { return fromString(name, CommunicationServicesProvisioningState.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DnsRecord.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DnsRecord.java index 328eac8efbbc0..f2e82d01e4e28 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DnsRecord.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DnsRecord.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +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 represents a VerificationStatus record. */ @Immutable -public final class DnsRecord { +public final class DnsRecord implements JsonSerializable { /* * Type of the DNS record. Example: TXT */ - @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) private String type; /* * Name of the DNS record. */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* * Value of the DNS record. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private String value; /* * Represents an expiry time in seconds to represent how long this entry can be cached by the resolver, default = * 3600sec. */ - @JsonProperty(value = "ttl", access = JsonProperty.Access.WRITE_ONLY) private Integer ttl; /** @@ -87,4 +87,45 @@ public Integer ttl() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DnsRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DnsRecord 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 DnsRecord. + */ + public static DnsRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DnsRecord deserializedDnsRecord = new DnsRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedDnsRecord.type = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDnsRecord.name = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedDnsRecord.value = reader.getString(); + } else if ("ttl".equals(fieldName)) { + deserializedDnsRecord.ttl = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedDnsRecord; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainManagement.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainManagement.java index b891481a0c41d..9d9ff6bd6cbd4 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainManagement.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainManagement.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -43,7 +42,6 @@ public DomainManagement() { * @param name a name to look for. * @return the corresponding DomainManagement. */ - @JsonCreator public static DomainManagement fromString(String name) { return fromString(name, DomainManagement.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainPropertiesVerificationRecords.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainPropertiesVerificationRecords.java index 65fad00f5a807..a1fe6bcdc3c74 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainPropertiesVerificationRecords.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainPropertiesVerificationRecords.java @@ -5,41 +5,41 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * List of DnsRecord. */ @Fluent -public final class DomainPropertiesVerificationRecords { +public final class DomainPropertiesVerificationRecords + implements JsonSerializable { /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "Domain") private DnsRecord domain; /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "SPF") private DnsRecord spf; /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "DKIM") private DnsRecord dkim; /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "DKIM2") private DnsRecord dkim2; /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "DMARC") private DnsRecord dmarc; /** @@ -170,4 +170,53 @@ public void validate() { dmarc().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("Domain", this.domain); + jsonWriter.writeJsonField("SPF", this.spf); + jsonWriter.writeJsonField("DKIM", this.dkim); + jsonWriter.writeJsonField("DKIM2", this.dkim2); + jsonWriter.writeJsonField("DMARC", this.dmarc); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DomainPropertiesVerificationRecords from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DomainPropertiesVerificationRecords 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 DomainPropertiesVerificationRecords. + */ + public static DomainPropertiesVerificationRecords fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DomainPropertiesVerificationRecords deserializedDomainPropertiesVerificationRecords + = new DomainPropertiesVerificationRecords(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("Domain".equals(fieldName)) { + deserializedDomainPropertiesVerificationRecords.domain = DnsRecord.fromJson(reader); + } else if ("SPF".equals(fieldName)) { + deserializedDomainPropertiesVerificationRecords.spf = DnsRecord.fromJson(reader); + } else if ("DKIM".equals(fieldName)) { + deserializedDomainPropertiesVerificationRecords.dkim = DnsRecord.fromJson(reader); + } else if ("DKIM2".equals(fieldName)) { + deserializedDomainPropertiesVerificationRecords.dkim2 = DnsRecord.fromJson(reader); + } else if ("DMARC".equals(fieldName)) { + deserializedDomainPropertiesVerificationRecords.dmarc = DnsRecord.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDomainPropertiesVerificationRecords; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainPropertiesVerificationStates.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainPropertiesVerificationStates.java index 7190e1c162898..f0e7938caa030 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainPropertiesVerificationStates.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainPropertiesVerificationStates.java @@ -5,41 +5,40 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * List of VerificationStatusRecord. */ @Fluent -public final class DomainPropertiesVerificationStates { +public final class DomainPropertiesVerificationStates implements JsonSerializable { /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "Domain") private VerificationStatusRecord domain; /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "SPF") private VerificationStatusRecord spf; /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "DKIM") private VerificationStatusRecord dkim; /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "DKIM2") private VerificationStatusRecord dkim2; /* * A class that represents a VerificationStatus record. */ - @JsonProperty(value = "DMARC") private VerificationStatusRecord dmarc; /** @@ -170,4 +169,53 @@ public void validate() { dmarc().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("Domain", this.domain); + jsonWriter.writeJsonField("SPF", this.spf); + jsonWriter.writeJsonField("DKIM", this.dkim); + jsonWriter.writeJsonField("DKIM2", this.dkim2); + jsonWriter.writeJsonField("DMARC", this.dmarc); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DomainPropertiesVerificationStates from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DomainPropertiesVerificationStates 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 DomainPropertiesVerificationStates. + */ + public static DomainPropertiesVerificationStates fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DomainPropertiesVerificationStates deserializedDomainPropertiesVerificationStates + = new DomainPropertiesVerificationStates(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("Domain".equals(fieldName)) { + deserializedDomainPropertiesVerificationStates.domain = VerificationStatusRecord.fromJson(reader); + } else if ("SPF".equals(fieldName)) { + deserializedDomainPropertiesVerificationStates.spf = VerificationStatusRecord.fromJson(reader); + } else if ("DKIM".equals(fieldName)) { + deserializedDomainPropertiesVerificationStates.dkim = VerificationStatusRecord.fromJson(reader); + } else if ("DKIM2".equals(fieldName)) { + deserializedDomainPropertiesVerificationStates.dkim2 = VerificationStatusRecord.fromJson(reader); + } else if ("DMARC".equals(fieldName)) { + deserializedDomainPropertiesVerificationStates.dmarc = VerificationStatusRecord.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDomainPropertiesVerificationStates; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainResourceList.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainResourceList.java index 24dc8bee18abd..302ab31d5c838 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainResourceList.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainResourceList.java @@ -5,26 +5,28 @@ 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.DomainResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Object that includes an array of Domains resource and a possible link for next set. */ @Fluent -public final class DomainResourceList { +public final class DomainResourceList implements JsonSerializable { /* * List of Domains resource */ - @JsonProperty(value = "value") private List value; /* * The URL the client should use to fetch the next page (per server side paging). * It's null for now, added for future use. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -85,4 +87,45 @@ public void validate() { 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 DomainResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DomainResourceList 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 DomainResourceList. + */ + public static DomainResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DomainResourceList deserializedDomainResourceList = new DomainResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DomainResourceInner.fromJson(reader1)); + deserializedDomainResourceList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDomainResourceList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDomainResourceList; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainsProvisioningState.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainsProvisioningState.java index 270d189c1d259..d6c092930d22d 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainsProvisioningState.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainsProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -72,7 +71,6 @@ public DomainsProvisioningState() { * @param name a name to look for. * @return the corresponding DomainsProvisioningState. */ - @JsonCreator public static DomainsProvisioningState fromString(String name) { return fromString(name, DomainsProvisioningState.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResourceList.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResourceList.java index c34dec41a8d94..a35cbf9d9ddbe 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResourceList.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResourceList.java @@ -5,26 +5,28 @@ 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.EmailServiceResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Object that includes an array of EmailServices and a possible link for next set. */ @Fluent -public final class EmailServiceResourceList { +public final class EmailServiceResourceList implements JsonSerializable { /* * List of EmailService */ - @JsonProperty(value = "value") private List value; /* * The URL the client should use to fetch the next page (per server side paging). * It's null for now, added for future use. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -85,4 +87,45 @@ public void validate() { 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 EmailServiceResourceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EmailServiceResourceList 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 EmailServiceResourceList. + */ + public static EmailServiceResourceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EmailServiceResourceList deserializedEmailServiceResourceList = new EmailServiceResourceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> EmailServiceResourceInner.fromJson(reader1)); + deserializedEmailServiceResourceList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEmailServiceResourceList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEmailServiceResourceList; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResourceUpdate.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResourceUpdate.java index ce06daa404bf3..46f22e07395e0 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResourceUpdate.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResourceUpdate.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** @@ -34,6 +38,42 @@ public EmailServiceResourceUpdate withTags(Map tags) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EmailServiceResourceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EmailServiceResourceUpdate 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 EmailServiceResourceUpdate. + */ + public static EmailServiceResourceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EmailServiceResourceUpdate deserializedEmailServiceResourceUpdate = new EmailServiceResourceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEmailServiceResourceUpdate.withTags(tags); + } else { + reader.skipChildren(); + } + } + + return deserializedEmailServiceResourceUpdate; + }); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServicesProvisioningState.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServicesProvisioningState.java index 4cc7a53662361..3c8e958f77e32 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServicesProvisioningState.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServicesProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -72,7 +71,6 @@ public EmailServicesProvisioningState() { * @param name a name to look for. * @return the corresponding EmailServicesProvisioningState. */ - @JsonCreator public static EmailServicesProvisioningState fromString(String name) { return fromString(name, EmailServicesProvisioningState.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/KeyType.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/KeyType.java index fe500efcc68ee..3b6a163e2e109 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/KeyType.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/KeyType.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.communication.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). */ @@ -36,7 +33,6 @@ public enum KeyType { * @param value the serialized value to parse. * @return the parsed KeyType object, or null if unable to parse. */ - @JsonCreator public static KeyType fromString(String value) { if (value == null) { return null; @@ -53,7 +49,6 @@ public static KeyType fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkNotificationHubParameters.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkNotificationHubParameters.java index 6c7cbde488a40..1c7bd9550153c 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkNotificationHubParameters.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkNotificationHubParameters.java @@ -6,23 +6,25 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Description of an Azure Notification Hub to link to the communication service. */ @Fluent -public final class LinkNotificationHubParameters { +public final class LinkNotificationHubParameters implements JsonSerializable { /* * The resource ID of the notification hub */ - @JsonProperty(value = "resourceId", required = true) private String resourceId; /* * Connection string for the notification hub */ - @JsonProperty(value = "connectionString", required = true) private String connectionString; /** @@ -78,14 +80,57 @@ public LinkNotificationHubParameters withConnectionString(String connectionStrin */ public void validate() { if (resourceId() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property resourceId in model LinkNotificationHubParameters")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceId in model LinkNotificationHubParameters")); } if (connectionString() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property connectionString in model LinkNotificationHubParameters")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property connectionString in model LinkNotificationHubParameters")); } } private static final ClientLogger LOGGER = new ClientLogger(LinkNotificationHubParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("connectionString", this.connectionString); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinkNotificationHubParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinkNotificationHubParameters 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 LinkNotificationHubParameters. + */ + public static LinkNotificationHubParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinkNotificationHubParameters deserializedLinkNotificationHubParameters + = new LinkNotificationHubParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceId".equals(fieldName)) { + deserializedLinkNotificationHubParameters.resourceId = reader.getString(); + } else if ("connectionString".equals(fieldName)) { + deserializedLinkNotificationHubParameters.connectionString = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLinkNotificationHubParameters; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentity.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentity.java index 1ae0ee218eff3..6318e9786110b 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentity.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentity.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +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.Map; import java.util.UUID; @@ -15,36 +18,30 @@ * Managed service identity (system assigned and/or user assigned identities). */ @Fluent -public final class ManagedServiceIdentity { +public final class ManagedServiceIdentity implements JsonSerializable { /* * The service principal ID of the system assigned identity. This property will only be provided for a system * assigned identity. */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) private UUID principalId; /* * The tenant ID of the system assigned identity. This property will only be provided for a system assigned * identity. */ - @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) private UUID tenantId; /* * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ - @JsonProperty(value = "type", required = true) private ManagedServiceIdentityType type; /* - * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys - * will be ARM resource ids in the form: + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will + * be ARM resource ids in the form: * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ - * userAssignedIdentities/{identityName}. - * The dictionary values can be empty objects ({}) in requests. + * userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. */ - @JsonProperty(value = "userAssignedIdentities") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map userAssignedIdentities; /** @@ -64,8 +61,8 @@ public UUID principalId() { } /** - * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided - * for a system assigned identity. + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. * * @return the tenantId value. */ @@ -128,8 +125,8 @@ public ManagedServiceIdentity withUserAssignedIdentities(Map { @@ -141,4 +138,53 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity 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 ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentityType.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentityType.java index c0ec9dbab3a8d..ea5ce30c421db 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentityType.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentityType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -48,7 +47,6 @@ public ManagedServiceIdentityType() { * @param name a name to look for. * @return the corresponding ManagedServiceIdentityType. */ - @JsonCreator public static ManagedServiceIdentityType fromString(String name) { return fromString(name, ManagedServiceIdentityType.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailabilityParameters.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailabilityParameters.java index 6033f569df575..fba300cb1f4ee 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailabilityParameters.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailabilityParameters.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Data POST-ed to the nameAvailability action. @@ -42,6 +46,44 @@ public NameAvailabilityParameters withType(String type) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeStringField("type", type()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NameAvailabilityParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NameAvailabilityParameters 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 NameAvailabilityParameters. + */ + public static NameAvailabilityParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NameAvailabilityParameters deserializedNameAvailabilityParameters = new NameAvailabilityParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedNameAvailabilityParameters.withName(reader.getString()); + } else if ("type".equals(fieldName)) { + deserializedNameAvailabilityParameters.withType(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedNameAvailabilityParameters; + }); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationDisplay.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationDisplay.java index fddedc959edf2..8f7db6112ea72 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationDisplay.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationDisplay.java @@ -5,38 +5,38 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Localized display information for this particular operation. */ @Immutable -public final class OperationDisplay { +public final class OperationDisplay implements JsonSerializable { /* - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - * Compute". + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". */ - @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) private String provider; /* - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - * Schedule Collections". + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". */ - @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) private String resource; /* - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - * Machine", "Restart Virtual Machine". + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". */ - @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) private String operation; /* * The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /** @@ -92,4 +92,45 @@ public String description() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay 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 OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationListResult.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationListResult.java index abac3a9c39dce..27c9e898b150a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationListResult.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationListResult.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.fluent.models.OperationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** - * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set - * of results. + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. */ @Immutable -public final class OperationListResult { +public final class OperationListResult implements JsonSerializable { /* * List of operations supported by the resource provider */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL to get the next set of operation list results (if there are any). */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -61,4 +63,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Origin.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Origin.java index 1f7196dbdb711..49fc8e124fd4a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Origin.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Origin.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -43,7 +42,6 @@ public Origin() { * @param name a name to look for. * @return the corresponding Origin. */ - @JsonCreator public static Origin fromString(String name) { return fromString(name, Origin.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ProvisioningState.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ProvisioningState.java index db3e78f02bc9c..697f0cbea5a7b 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ProvisioningState.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -72,7 +71,6 @@ public ProvisioningState() { * @param name a name to look for. * @return the corresponding ProvisioningState. */ - @JsonCreator public static ProvisioningState fromString(String name) { return fromString(name, ProvisioningState.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/RegenerateKeyParameters.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/RegenerateKeyParameters.java index 1db0bef7e4221..0862df5ed582d 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/RegenerateKeyParameters.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/RegenerateKeyParameters.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Parameters describes the request to regenerate access keys. */ @Fluent -public final class RegenerateKeyParameters { +public final class RegenerateKeyParameters implements JsonSerializable { /* * The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). */ - @JsonProperty(value = "keyType") private KeyType keyType; /** @@ -51,4 +54,40 @@ public RegenerateKeyParameters withKeyType(KeyType keyType) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyType", this.keyType == null ? null : this.keyType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegenerateKeyParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegenerateKeyParameters 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 RegenerateKeyParameters. + */ + public static RegenerateKeyParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegenerateKeyParameters deserializedRegenerateKeyParameters = new RegenerateKeyParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyType".equals(fieldName)) { + deserializedRegenerateKeyParameters.keyType = KeyType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRegenerateKeyParameters; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SenderUsernameResourceCollection.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SenderUsernameResourceCollection.java index e7b04adfe9a8d..f44c90f140ec6 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SenderUsernameResourceCollection.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SenderUsernameResourceCollection.java @@ -5,25 +5,27 @@ 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.SenderUsernameResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * A class representing a Domains SenderUsernames collection. */ @Fluent -public final class SenderUsernameResourceCollection { +public final class SenderUsernameResourceCollection implements JsonSerializable { /* * List of SenderUsernames */ - @JsonProperty(value = "value") private List value; /* * The URL the client should use to fetch the next page (per server side paging). */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -82,4 +84,46 @@ public void validate() { 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 SenderUsernameResourceCollection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SenderUsernameResourceCollection 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 SenderUsernameResourceCollection. + */ + public static SenderUsernameResourceCollection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SenderUsernameResourceCollection deserializedSenderUsernameResourceCollection + = new SenderUsernameResourceCollection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SenderUsernameResourceInner.fromJson(reader1)); + deserializedSenderUsernameResourceCollection.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSenderUsernameResourceCollection.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSenderUsernameResourceCollection; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java index fd808e49446b9..289750045d511 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java @@ -5,20 +5,21 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +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.Map; /** * An ARM resource with that can accept tags. */ @Fluent -public class TaggedResource { +public class TaggedResource implements JsonSerializable { /* * Tags of the service which is a list of key value pairs that describe the resource. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** @@ -54,4 +55,41 @@ public TaggedResource withTags(Map tags) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaggedResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaggedResource 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 TaggedResource. + */ + public static TaggedResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaggedResource deserializedTaggedResource = new TaggedResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTaggedResource.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedTaggedResource; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UpdateDomainRequestParameters.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UpdateDomainRequestParameters.java index 42830a1653a27..202abddc00385 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UpdateDomainRequestParameters.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UpdateDomainRequestParameters.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.communication.fluent.models.UpdateDomainProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -17,7 +20,6 @@ public final class UpdateDomainRequestParameters extends TaggedResource { /* * A class that describes the updatable properties of a Domains resource. */ - @JsonProperty(value = "properties") private UpdateDomainProperties innerProperties; /** @@ -74,9 +76,49 @@ public UpdateDomainRequestParameters withUserEngagementTracking(UserEngagementTr */ @Override public void validate() { - super.validate(); if (innerProperties() != null) { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateDomainRequestParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateDomainRequestParameters 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 UpdateDomainRequestParameters. + */ + public static UpdateDomainRequestParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateDomainRequestParameters deserializedUpdateDomainRequestParameters + = new UpdateDomainRequestParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedUpdateDomainRequestParameters.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedUpdateDomainRequestParameters.innerProperties = UpdateDomainProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateDomainRequestParameters; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserAssignedIdentity.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserAssignedIdentity.java index b50aea06f0b0e..ae114b34382d5 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserAssignedIdentity.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserAssignedIdentity.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +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.UUID; /** * User assigned identity properties. */ @Immutable -public final class UserAssignedIdentity { +public final class UserAssignedIdentity implements JsonSerializable { /* * The principal ID of the assigned identity. */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) private UUID principalId; /* * The client ID of the assigned identity. */ - @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) private UUID clientId; /** @@ -56,4 +58,43 @@ public UUID clientId() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity 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 UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserEngagementTracking.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserEngagementTracking.java index 9c9e3a0adc4e6..9b443acc59018 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserEngagementTracking.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserEngagementTracking.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public UserEngagementTracking() { * @param name a name to look for. * @return the corresponding UserEngagementTracking. */ - @JsonCreator public static UserEngagementTracking fromString(String name) { return fromString(name, UserEngagementTracking.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationParameter.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationParameter.java index 22d65ccc58295..e8f8d2d48b303 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationParameter.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationParameter.java @@ -6,17 +6,20 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Input parameter for verification APIs. */ @Fluent -public final class VerificationParameter { +public final class VerificationParameter implements JsonSerializable { /* * Type of verification. */ - @JsonProperty(value = "verificationType", required = true) private VerificationType verificationType; /** @@ -52,10 +55,50 @@ public VerificationParameter withVerificationType(VerificationType verificationT */ public void validate() { if (verificationType() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property verificationType in model VerificationParameter")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property verificationType in model VerificationParameter")); } } private static final ClientLogger LOGGER = new ClientLogger(VerificationParameter.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("verificationType", + this.verificationType == null ? null : this.verificationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VerificationParameter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VerificationParameter 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 VerificationParameter. + */ + public static VerificationParameter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VerificationParameter deserializedVerificationParameter = new VerificationParameter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("verificationType".equals(fieldName)) { + deserializedVerificationParameter.verificationType + = VerificationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVerificationParameter; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationStatus.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationStatus.java index 63622e2ea05dc..e4f2ba7862df9 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationStatus.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -57,7 +56,6 @@ public VerificationStatus() { * @param name a name to look for. * @return the corresponding VerificationStatus. */ - @JsonCreator public static VerificationStatus fromString(String name) { return fromString(name, VerificationStatus.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationStatusRecord.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationStatusRecord.java index 8dd2e2f35855b..26983bdc54c36 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationStatusRecord.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationStatusRecord.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +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 represents a VerificationStatus record. */ @Immutable -public final class VerificationStatusRecord { +public final class VerificationStatusRecord implements JsonSerializable { /* * Status of the verification operation. */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private VerificationStatus status; /* * Error code. This property will only be present if the status is UnableToVerify. */ - @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) private String errorCode; /** @@ -55,4 +57,41 @@ public String errorCode() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VerificationStatusRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VerificationStatusRecord 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 VerificationStatusRecord. + */ + public static VerificationStatusRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VerificationStatusRecord deserializedVerificationStatusRecord = new VerificationStatusRecord(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedVerificationStatusRecord.status = VerificationStatus.fromString(reader.getString()); + } else if ("errorCode".equals(fieldName)) { + deserializedVerificationStatusRecord.errorCode = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVerificationStatusRecord; + }); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationType.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationType.java index 7bd5f930f7889..de7ad0f63ab34 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationType.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/VerificationType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.communication.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public VerificationType() { * @param name a name to look for. * @return the corresponding VerificationType. */ - @JsonCreator public static VerificationType fromString(String name) { return fromString(name, VerificationType.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/module-info.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/module-info.java index 742f4c0af53a3..2691707a69081 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/module-info.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/module-info.java @@ -10,6 +10,6 @@ exports com.azure.resourcemanager.communication.fluent.models; exports com.azure.resourcemanager.communication.models; - opens com.azure.resourcemanager.communication.fluent.models to com.azure.core, com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.communication.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.communication.fluent.models to com.azure.core; + opens com.azure.resourcemanager.communication.models to com.azure.core; } 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 066a7deb03188..814adfa4e50fa 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.OperationsClientImpl$OperationsService" ], [ "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.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"]] \ No newline at end of file diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communication/reflect-config.json b/sdk/communication/azure-resourcemanager-communication/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communication/reflect-config.json index 13883cefcfb4e..0637a088a01e8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communication/reflect-config.json +++ b/sdk/communication/azure-resourcemanager-communication/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communication/reflect-config.json @@ -1,241 +1 @@ -[ { - "name" : "com.azure.resourcemanager.communication.models.OperationListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.OperationInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.OperationDisplay", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.NameAvailabilityParameters", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.CheckNameAvailabilityRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.CheckNameAvailabilityResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.LinkNotificationHubParameters", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.CommunicationServiceResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.CommunicationServiceProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.ManagedServiceIdentity", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.UserAssignedIdentity", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.CommunicationServiceResourceUpdate", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.CommunicationServiceUpdateProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.TaggedResource", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.CommunicationServiceKeysInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.RegenerateKeyParameters", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.DomainResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.DomainProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.DomainPropertiesVerificationStates", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.VerificationStatusRecord", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.DomainPropertiesVerificationRecords", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.DnsRecord", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.UpdateDomainRequestParameters", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.UpdateDomainProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.DomainResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.VerificationParameter", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.EmailServiceResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.EmailServiceProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.EmailServiceResourceUpdate", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.EmailServiceResourceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.SenderUsernameResourceCollection", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.SenderUsernameResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.fluent.models.SenderUsernameProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.Origin", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.ActionType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.CheckNameAvailabilityReason", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.CommunicationServicesProvisioningState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.ManagedServiceIdentityType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.DomainsProvisioningState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.DomainManagement", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.VerificationStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.UserEngagementTracking", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.VerificationType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.EmailServicesProvisioningState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.ProvisioningState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.communication.models.KeyType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -} ] \ No newline at end of file +[] \ 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 7b5b100a733d2..f2b2def9dd72d 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 @@ -22,9 +22,9 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { */ public static void checkNameAvailabilityAvailable(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().checkNameAvailabilityWithResponse(new NameAvailabilityParameters() - .withName("MyCommunicationService").withType("Microsoft.Communication/CommunicationServices"), - com.azure.core.util.Context.NONE); + manager.communicationServices() + .checkNameAvailabilityWithResponse(new NameAvailabilityParameters().withName("MyCommunicationService") + .withType("Microsoft.Communication/CommunicationServices"), com.azure.core.util.Context.NONE); } /* @@ -39,8 +39,8 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { */ public static void checkNameAvailabilityUnavailable(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().checkNameAvailabilityWithResponse(new NameAvailabilityParameters() - .withName("MyCommunicationService").withType("Microsoft.Communication/CommunicationServices"), - com.azure.core.util.Context.NONE); + manager.communicationServices() + .checkNameAvailabilityWithResponse(new NameAvailabilityParameters().withName("MyCommunicationService") + .withType("Microsoft.Communication/CommunicationServices"), com.azure.core.util.Context.NONE); } } 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 c0ef8e0533ea1..2885f33fe237c 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 @@ -22,8 +22,12 @@ public final class CommunicationServicesCreateOrUpdateSamples { * @param manager Entry point to CommunicationManager. */ public static void createOrUpdateResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().define("MyCommunicationResource").withRegion("Global") - .withExistingResourceGroup("MyResourceGroup").withDataLocation("United States").create(); + manager.communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withDataLocation("United States") + .create(); } /* @@ -38,9 +42,12 @@ public static void createOrUpdateResource(com.azure.resourcemanager.communicatio */ public static void createOrUpdateResourceWithManagedIdentity( com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().define("MyCommunicationResource").withRegion("Global") + manager.communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") .withExistingResourceGroup("MyResourceGroup") .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) - .withDataLocation("United States").create(); + .withDataLocation("United States") + .create(); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java index 51f7e71f26f92..703e279188da3 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 @@ -19,7 +19,7 @@ public final class CommunicationServicesDeleteSamples { * @param manager Entry point to CommunicationManager. */ public static void deleteResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().delete("MyResourceGroup", "MyCommunicationResource", - com.azure.core.util.Context.NONE); + manager.communicationServices() + .delete("MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE); } } 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 ddb5c746d0843..ff6665ac2c037 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 @@ -19,7 +19,8 @@ public final class CommunicationServicesGetByResourceGroupSamples { * @param manager Entry point to CommunicationManager. */ public static void getResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", - com.azure.core.util.Context.NONE); + manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE); } } 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 1a344e25ec799..c6d21ee609e17 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 @@ -21,10 +21,11 @@ public final class CommunicationServicesLinkNotificationHubSamples { * @param manager Entry point to CommunicationManager. */ public static void linkNotificationHub(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().linkNotificationHubWithResponse("MyResourceGroup", "MyCommunicationResource", - new LinkNotificationHubParameters().withResourceId( - "/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/notificationHubs/MyHub") - .withConnectionString("Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234"), - com.azure.core.util.Context.NONE); + manager.communicationServices() + .linkNotificationHubWithResponse("MyResourceGroup", "MyCommunicationResource", + new LinkNotificationHubParameters().withResourceId( + "/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/notificationHubs/MyHub") + .withConnectionString("Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234"), + com.azure.core.util.Context.NONE); } } 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 5be88879ee4bd..937f1dbe01579 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 @@ -19,7 +19,7 @@ public final class CommunicationServicesListKeysSamples { * @param manager Entry point to CommunicationManager. */ public static void listKeys(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().listKeysWithResponse("MyResourceGroup", "MyCommunicationResource", - com.azure.core.util.Context.NONE); + manager.communicationServices() + .listKeysWithResponse("MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE); } } 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 fe9a09952eaa0..f53f42e767dac 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 @@ -22,7 +22,8 @@ public final class CommunicationServicesRegenerateKeySamples { * @param manager Entry point to CommunicationManager. */ public static void regenerateKey(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.communicationServices().regenerateKeyWithResponse("MyResourceGroup", "MyCommunicationResource", - new RegenerateKeyParameters().withKeyType(KeyType.PRIMARY), com.azure.core.util.Context.NONE); + manager.communicationServices() + .regenerateKeyWithResponse("MyResourceGroup", "MyCommunicationResource", + new RegenerateKeyParameters().withKeyType(KeyType.PRIMARY), com.azure.core.util.Context.NONE); } } 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 d7bedd5b90e89..b0c1204370e1a 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 @@ -26,9 +26,10 @@ public final class CommunicationServicesUpdateSamples { * @param manager Entry point to CommunicationManager. */ public static void updateResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("newTag", "newVal")).apply(); } @@ -44,10 +45,12 @@ public static void updateResource(com.azure.resourcemanager.communication.Commun */ public static void updateResourceToAddAUserAssignedManagedIdentity( com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); - resource.update().withTags(mapOf("newTag", "newVal")) + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) .withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity()))) .apply(); @@ -65,11 +68,14 @@ public static void updateResourceToAddAUserAssignedManagedIdentity( */ public static void updateResourceToAddASystemAssignedManagedIdentity( com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); - resource.update().withTags(mapOf("newTag", "newVal")) - .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)).apply(); + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .apply(); } /* @@ -84,11 +90,14 @@ public static void updateResourceToAddASystemAssignedManagedIdentity( */ public static void updateResourceToRemoveIdentity(com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); - resource.update().withTags(mapOf("newTag", "newVal")) - .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply(); + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)) + .apply(); } /* @@ -103,10 +112,12 @@ public static void updateResourceToAddASystemAssignedManagedIdentity( */ public static void updateResourceToAddSystemAndUserManagedIdentities( com.azure.resourcemanager.communication.CommunicationManager manager) { - CommunicationServiceResource resource - = manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyCommunicationResource", com.azure.core.util.Context.NONE).getValue(); - resource.update().withTags(mapOf("newTag", "newVal")) + CommunicationServiceResource resource = manager.communicationServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyCommunicationResource", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("newTag", "newVal")) .withIdentity( new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) .withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity()))) 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 5174fb25105bf..6b988ec97d3bc 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 @@ -22,7 +22,9 @@ public final class DomainsCancelVerificationSamples { * @param manager Entry point to CommunicationManager. */ public static void cancelVerification(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().cancelVerification("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - new VerificationParameter().withVerificationType(VerificationType.SPF), com.azure.core.util.Context.NONE); + manager.domains() + .cancelVerification("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + new VerificationParameter().withVerificationType(VerificationType.SPF), + com.azure.core.util.Context.NONE); } } 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 4ed0aa6e3bf92..727249420c679 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 @@ -22,8 +22,11 @@ public final class DomainsCreateOrUpdateSamples { */ public static void createOrUpdateDomainsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().define("mydomain.com").withRegion("Global") + manager.domains() + .define("mydomain.com") + .withRegion("Global") .withExistingEmailService("MyResourceGroup", "MyEmailServiceResource") - .withDomainManagement(DomainManagement.CUSTOMER_MANAGED).create(); + .withDomainManagement(DomainManagement.CUSTOMER_MANAGED) + .create(); } } 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 e24f594cc2c51..0ba66faf90aaf 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 @@ -19,7 +19,7 @@ public final class DomainsDeleteSamples { * @param manager Entry point to CommunicationManager. */ public static void deleteDomainsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().delete("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - com.azure.core.util.Context.NONE); + manager.domains() + .delete("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", com.azure.core.util.Context.NONE); } } 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 0cdc1b87862c5..abc3106b1eee7 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 @@ -18,7 +18,8 @@ public final class DomainsGetSamples { * @param manager Entry point to CommunicationManager. */ public static void getDomainsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().getWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - com.azure.core.util.Context.NONE); + manager.domains() + .getWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + com.azure.core.util.Context.NONE); } } 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 88c3b133e4795..ab5b371351bf2 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 @@ -22,7 +22,9 @@ public final class DomainsInitiateVerificationSamples { * @param manager Entry point to CommunicationManager. */ public static void initiateVerification(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().initiateVerification("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - new VerificationParameter().withVerificationType(VerificationType.SPF), com.azure.core.util.Context.NONE); + manager.domains() + .initiateVerification("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + new VerificationParameter().withVerificationType(VerificationType.SPF), + com.azure.core.util.Context.NONE); } } 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 f13500d4c989e..dba15c81b5aa7 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 @@ -20,7 +20,7 @@ public final class DomainsListByEmailServiceResourceSamples { */ public static void listDomainsResourcesByEmailServiceName(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.domains().listByEmailServiceResource("MyResourceGroup", "MyEmailServiceResource", - com.azure.core.util.Context.NONE); + manager.domains() + .listByEmailServiceResource("MyResourceGroup", "MyEmailServiceResource", com.azure.core.util.Context.NONE); } } 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 ae5a64899dcdf..28333abdfb60a 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 @@ -22,8 +22,10 @@ public final class DomainsUpdateSamples { * @param manager Entry point to CommunicationManager. */ public static void updateDomainsResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - DomainResource resource = manager.domains().getWithResponse("MyResourceGroup", "MyEmailServiceResource", - "mydomain.com", com.azure.core.util.Context.NONE).getValue(); + DomainResource resource = manager.domains() + .getWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().withUserEngagementTracking(UserEngagementTracking.ENABLED).apply(); } } 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 61f8ceba24424..d9db566d39aa3 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 @@ -20,7 +20,11 @@ public final class EmailServicesCreateOrUpdateSamples { */ public static void createOrUpdateEmailServiceResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.emailServices().define("MyEmailServiceResource").withRegion("Global") - .withExistingResourceGroup("MyResourceGroup").withDataLocation("United States").create(); + manager.emailServices() + .define("MyEmailServiceResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withDataLocation("United States") + .create(); } } 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 7f5f09eaefc0f..3b1209179819d 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 @@ -19,7 +19,8 @@ public final class EmailServicesGetByResourceGroupSamples { * @param manager Entry point to CommunicationManager. */ public static void getEmailServiceResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.emailServices().getByResourceGroupWithResponse("MyResourceGroup", "MyEmailServiceResource", - com.azure.core.util.Context.NONE); + manager.emailServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyEmailServiceResource", + com.azure.core.util.Context.NONE); } } 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 6234c0f31ba8a..90abf280286a4 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 @@ -24,8 +24,10 @@ public final class EmailServicesUpdateSamples { */ public static void updateEmailServiceResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - EmailServiceResource resource = manager.emailServices().getByResourceGroupWithResponse("MyResourceGroup", - "MyEmailServiceResource", com.azure.core.util.Context.NONE).getValue(); + EmailServiceResource resource = manager.emailServices() + .getByResourceGroupWithResponse("MyResourceGroup", "MyEmailServiceResource", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("newTag", "newVal")).apply(); } 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 39a1a9e47691d..7e1519ac0dd07 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 @@ -20,8 +20,11 @@ public final class SenderUsernamesCreateOrUpdateSamples { */ public static void createOrUpdateSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.senderUsernames().define("contosoNewsAlerts") + manager.senderUsernames() + .define("contosoNewsAlerts") .withExistingDomain("contosoResourceGroup", "contosoEmailService", "contoso.com") - .withUsername("contosoNewsAlerts").withDisplayName("Contoso News Alerts").create(); + .withUsername("contosoNewsAlerts") + .withDisplayName("Contoso News Alerts") + .create(); } } 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 dafdb1813a6f0..5abb8137e29be 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 @@ -20,7 +20,8 @@ public final class SenderUsernamesDeleteSamples { */ public static void deleteSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.senderUsernames().deleteWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", - "contosoNewsAlerts", com.azure.core.util.Context.NONE); + manager.senderUsernames() + .deleteWithResponse("MyResourceGroup", "MyEmailServiceResource", "mydomain.com", "contosoNewsAlerts", + com.azure.core.util.Context.NONE); } } 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 640700a845d2b..0cd27a5bc6e32 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 @@ -20,7 +20,8 @@ public final class SenderUsernamesGetSamples { */ public static void getSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.senderUsernames().getWithResponse("contosoResourceGroup", "contosoEmailService", "contoso.com", - "contosoNewsAlerts", com.azure.core.util.Context.NONE); + manager.senderUsernames() + .getWithResponse("contosoResourceGroup", "contosoEmailService", "contoso.com", "contosoNewsAlerts", + com.azure.core.util.Context.NONE); } } 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 2b5e206b125f8..bfeeade7fd4d2 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 @@ -20,7 +20,8 @@ public final class SenderUsernamesListByDomainsSamples { */ public static void getSenderUsernamesResource(com.azure.resourcemanager.communication.CommunicationManager manager) { - manager.senderUsernames().listByDomains("contosoResourceGroup", "contosoEmailService", "contoso.com", - com.azure.core.util.Context.NONE); + manager.senderUsernames() + .listByDomains("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/CommunicationServiceResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java index 97a08b2778288..257db00321dee 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java @@ -18,7 +18,7 @@ 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\":\"3be39144-f5db-4d95-a423-901fe2c71743\",\"tenantId\":\"5eed8049-2baf-4291-8ae1-a28d5ca55c0f\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"icndvkaozwyifty\":{\"principalId\":\"2dba58c6-e1b7-48a0-8457-6f9eda4da645\",\"clientId\":\"39146c26-b00c-4f50-8261-625c41383ead\"},\"urokft\":{\"principalId\":\"2affca77-44bb-412b-923b-629c333f41b1\",\"clientId\":\"d9e394ab-bcf6-427f-8a26-28182ed95220\"},\"lniwpwcukjfkgiaw\":{\"principalId\":\"8680008c-30a6-4d01-8316-a3a6716c164d\",\"clientId\":\"19d70193-a0f9-41f3-ba3a-40df75ed6670\"}}},\"location\":\"lryplwckbasyy\",\"tags\":{\"phejkotynqgoulz\":\"dhsgcba\",\"gakeqsr\":\"dlikwyqkgfgibma\",\"qqedqytbciqfou\":\"yb\"},\"id\":\"lmmnkzsmodmglo\",\"name\":\"gpbkwtmut\",\"type\":\"uqktap\"}") + "{\"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")); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java index cc3661fa68e4a..32e1755b0da4f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java @@ -19,7 +19,7 @@ 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\":\"ef9eb9da-900a-4144-ad27-a9b0a76e515d\",\"tenantId\":\"ee78ee04-5488-49a6-b105-eaa8a59fd4b0\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"tegjvwmf\":{\"principalId\":\"86be38b7-b6b7-4b42-bd48-8be5806672da\",\"clientId\":\"b7b48f5e-f095-4c96-96a6-554206c17dd1\"},\"scmdvpjhulsuu\":{\"principalId\":\"b9807eea-7284-4e49-9b53-ca66d768d5cb\",\"clientId\":\"bdce0daa-ecdc-4e3a-8ffe-97c4b145c93a\"},\"jozkrwfndiod\":{\"principalId\":\"fd1ce9f2-ee54-4212-abbc-317e0597ecaf\",\"clientId\":\"82f841a7-6458-4ad9-9b7f-5ca541098843\"},\"lwejdpv\":{\"principalId\":\"09c23d8b-6df2-4ef9-a643-2e400db91f86\",\"clientId\":\"09585243-6cce-4b77-a7c8-021c95eb8e16\"}}},\"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\":\"b384ea4b-2bc3-4f19-9d4a-c97ac5dfcda2\",\"tenantId\":\"3d8dba7a-3e4b-44cd-9473-650ba5b0d1cb\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"nhungbw\":{\"principalId\":\"ecf55d34-1c17-4213-8a5b-b05dcccdc962\",\"clientId\":\"b6ed71ad-2d97-4eec-b344-85f512a698be\"}}},\"location\":\"rnfygxgispem\",\"tags\":{\"fxqeof\":\"fkufublj\",\"jqul\":\"aeqjhqjbasvms\",\"clxxwrljdo\":\"gsntnbybkzgcwr\"},\"id\":\"skcqvkocrcjd\",\"name\":\"wtnhxbnjbiksqr\",\"type\":\"lssai\"}],\"nextLink\":\"p\"}") + "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"mkkvnip\",\"dataLocation\":\"oxzjnchgejspod\",\"notificationHubId\":\"ilzyd\",\"version\":\"o\",\"immutableResourceId\":\"yahux\",\"linkedDomains\":[\"mqnjaqw\",\"xj\"]},\"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")); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java index 8eb78e0926395..0ad75909c2ea2 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java @@ -18,7 +18,7 @@ public final class CommunicationServiceResourceUpdateTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { CommunicationServiceResourceUpdate model = BinaryData.fromString( - "{\"properties\":{\"linkedDomains\":[\"jvtbvpyss\",\"dnrujqguhmuouqfp\"]},\"identity\":{\"principalId\":\"6211b490-391f-4b88-a622-b29fa0524dee\",\"tenantId\":\"49124dfc-70a5-407e-941f-67e66e775255\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"tnwu\":{\"principalId\":\"d34810c6-782e-42c1-9285-10f9e3568d49\",\"clientId\":\"5d70e04d-9075-4b18-8d87-b46281661276\"}}},\"tags\":{\"x\":\"a\",\"hr\":\"fizuckyf\"}}") + "{\"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()); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java index 69e1425309171..0fafff202bfed 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java @@ -6,45 +6,26 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CommunicationServicesCheckNameAvailabilityWithResponseMockTests { @Test public void testCheckNameAvailabilityWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"eyp\"}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java index d0edf03127fa8..c7b3450a93bed 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java @@ -6,17 +6,14 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.util.Arrays; @@ -24,32 +21,16 @@ import java.util.Map; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CommunicationServicesCreateOrUpdateMockTests { @Test public void testCreateOrUpdate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"hostName\":\"sfwxosowzxc\",\"dataLocation\":\"gicjooxdjeb\",\"notificationHubId\":\"ucww\",\"version\":\"ovbvmeueciv\",\"immutableResourceId\":\"zceuojgjrw\",\"linkedDomains\":[\"iotwmcdytdxwit\",\"nrjawgqwg\",\"hniskxfbkpyc\"]},\"identity\":{\"principalId\":\"81106beb-092d-40db-ba2b-4f7e526ae0c0\",\"tenantId\":\"80113ea7-1002-4294-a060-b9b71f05085d\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"dauwhvylwzbtd\":{\"principalId\":\"fc83ff1f-459a-446d-be3a-41088cf5e029\",\"clientId\":\"a6ee0e13-1149-444f-8ca1-eafb2a27af50\"},\"jznb\":{\"principalId\":\"6212c5f4-7e5f-47cb-8702-39f5f15b8259\",\"clientId\":\"42a647a1-eccd-4289-9371-48ded81c8b76\"}}},\"location\":\"ow\",\"tags\":{\"lupj\":\"rzqlveu\",\"riplrbpbewtg\":\"khfxobbcswsrt\"},\"id\":\"fgb\",\"name\":\"c\",\"type\":\"wxzvlvqhjkb\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); + = "{\"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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java index 6f9b61c8842bc..7fa5ec33f0019 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java @@ -6,41 +6,22 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CommunicationServicesDeleteMockTests { @Test public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java index 04c84f748a8d9..87eecc5151a10 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java @@ -6,45 +6,26 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CommunicationServicesGetByResourceGroupWithResponseMockTests { @Test public void testGetByResourceGroupWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr - = "{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"vmkfssxqu\",\"dataLocation\":\"kfplgmgsxnk\",\"notificationHubId\":\"kde\",\"version\":\"pvlopwiyighxpkd\",\"immutableResourceId\":\"baiuebbaumny\",\"linkedDomains\":[\"edeojnabc\"]},\"identity\":{\"principalId\":\"90fdda1a-2423-45b5-b479-d2875d87c96a\",\"tenantId\":\"90b43a81-6830-43c7-95fa-530d23bbd8e2\",\"type\":\"None\",\"userAssignedIdentities\":{\"ebtfhvpesap\":{\"principalId\":\"36b69f17-8df3-4d27-87c9-5b344e36ea49\",\"clientId\":\"a6beacf0-a8b3-42d5-b5e2-90c549cec587\"},\"dqmh\":{\"principalId\":\"639a2178-e33d-4939-8fa0-52a5a9c226aa\",\"clientId\":\"1944f363-64fc-450c-8df0-f000f6bca8df\"},\"htldwk\":{\"principalId\":\"94579b49-d73c-4fef-b4b8-87e7d6301a16\",\"clientId\":\"9af4da14-ac33-4e0a-877a-d9a295dc0d35\"}}},\"location\":\"xuutkncwscwsv\",\"tags\":{\"rupqsxvnmicy\":\"togt\",\"vei\":\"vce\",\"dhbt\":\"ovnotyfjfcnjbkcn\"},\"id\":\"kphywpnvjto\",\"name\":\"nermcl\",\"type\":\"plpho\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); + = "{\"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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java index 3f4d7968f6bea..36573d8b4a5f6 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java @@ -6,44 +6,25 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CommunicationServicesLinkNotificationHubWithResponseMockTests { @Test public void testLinkNotificationHubWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"resourceId\":\"civfsnkymuctq\"}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java index fa5c68b64c8f3..bc93d780d7ac8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java @@ -6,46 +6,27 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CommunicationServicesListByResourceGroupMockTests { @Test public void testListByResourceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"arbu\",\"dataLocation\":\"rcvpnazzmhjrunmp\",\"notificationHubId\":\"tdbhrbnla\",\"version\":\"xmyskp\",\"immutableResourceId\":\"enbtkcxywny\",\"linkedDomains\":[\"synlqidybyxczfc\"]},\"identity\":{\"principalId\":\"bf2be09a-79d1-4bfd-8556-fdcfa2f1c7d1\",\"tenantId\":\"7272b381-7584-43b2-9f5d-9987dbf5ed10\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"p\":{\"principalId\":\"41190edf-d46b-47c5-b956-6de1e0f169b6\",\"clientId\":\"f540ba33-a605-41e3-bb82-9635801f5ec5\"},\"rqlfktsthsucocmn\":{\"principalId\":\"2960e378-b58a-46d4-9647-3731440d096a\",\"clientId\":\"34d003dd-841b-4af2-ae4b-23dd8601e310\"},\"zt\":{\"principalId\":\"73f7f370-6377-4fa5-b684-b37feee8e273\",\"clientId\":\"4c7ff0ab-7003-4ee7-97b3-faef757a6879\"}}},\"location\":\"twwrqp\",\"tags\":{\"xibxujwbhqwalm\":\"ckzywbiexzfeyue\",\"ux\":\"zyoxaepdkzjan\",\"zt\":\"hdwbavxbniwdjs\"},\"id\":\"dbpgnxytxhp\",\"name\":\"xbzpfzab\",\"type\":\"lcuhxwtctyqiklb\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); + = "{\"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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java index 4d66da12cff73..1bf79cb1d3c99 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java @@ -6,46 +6,27 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CommunicationServicesListMockTests { @Test public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"brjcxe\",\"dataLocation\":\"fuwutttxf\",\"notificationHubId\":\"rbirphxe\",\"version\":\"yva\",\"immutableResourceId\":\"nljky\",\"linkedDomains\":[\"vuujq\"]},\"identity\":{\"principalId\":\"d1370ea4-70f5-4ddf-bb49-cb5a41fbae09\",\"tenantId\":\"f90dff6b-94fb-40e7-83dc-85438df93e2f\",\"type\":\"None\",\"userAssignedIdentities\":{\"yoxgvcltbgsnc\":{\"principalId\":\"191c3c83-857b-4b1a-bcda-1b65b274bc6a\",\"clientId\":\"2942f4e1-ae8f-4303-b88f-2ca0345e5ee2\"},\"jeszzhbijhtxfv\":{\"principalId\":\"9cd64346-ab86-4494-8699-1fa0d1670311\",\"clientId\":\"e5d37ff6-9006-4a9c-85bd-7d287ddbc539\"}}},\"location\":\"bfs\",\"tags\":{\"pvecxgodeb\":\"eh\",\"pukgriwflzlfb\":\"qkkrb\",\"qzahmgkbrp\":\"zpuzycisp\"},\"id\":\"y\",\"name\":\"hibnuqqkpika\",\"type\":\"rgvtqag\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); + = "{\"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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java index 89c3bbddf6113..8977e58e32fdb 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java @@ -6,41 +6,22 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class DomainsDeleteMockTests { @Test public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java index 9aabfc95c9a50..7d6c559cd88de 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java @@ -6,46 +6,27 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; 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 org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class EmailServicesCreateOrUpdateMockTests { @Test public void testCreateOrUpdate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"dataLocation\":\"xogaokonzmnsikv\"},\"location\":\"qzeqqkdltfzxm\",\"tags\":{\"dkwobdagx\":\"hgure\"},\"id\":\"ibqdxbxwakbogqx\",\"name\":\"dlkzgxhuri\",\"type\":\"lbpodxunk\"}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java index 3338860e4e3f3..9fd389f8620b0 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java @@ -6,41 +6,22 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class EmailServicesDeleteMockTests { @Test public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java index 92a8944d0a2ac..79ff6e600cc61 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java @@ -6,44 +6,25 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class EmailServicesGetByResourceGroupWithResponseMockTests { @Test public void testGetByResourceGroupWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"properties\":{\"provisioningState\":\"Running\",\"dataLocation\":\"gylgqgitxmedjvcs\"},\"location\":\"n\",\"tags\":{\"zhxgktrmgucn\":\"ncw\",\"llwptfdy\":\"pkteo\",\"rhhuaopppcqeqx\":\"pfqbuaceopzf\",\"izpost\":\"lzdahzxctobgbkdm\"},\"id\":\"grcfb\",\"name\":\"nrmfqjhhk\",\"type\":\"bpvjymjhx\"}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java index dc55d3e665968..e5fd8be78eaa5 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java @@ -6,45 +6,26 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class EmailServicesListByResourceGroupMockTests { @Test public void testListByResourceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - 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\"}]}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java index c6471e4dbb1fc..ca12011cd3e9b 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java @@ -6,45 +6,26 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class EmailServicesListMockTests { @Test public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - 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\"}]}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java index dbd0531ebb8ba..2255ecfc3236f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java @@ -6,43 +6,24 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; 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 org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests { @Test public void testListVerifiedExchangeOnlineDomainsWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "[\"olpsslqlf\",\"mdnbbglzpswiy\"]"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java index fd700b0ae41d9..31eb9a3fcf5a9 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java @@ -16,7 +16,7 @@ public final class ManagedServiceIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ManagedServiceIdentity model = BinaryData.fromString( - "{\"principalId\":\"bebc74ca-97ca-44ea-b2d5-b55c1210d16f\",\"tenantId\":\"f5291bd7-d061-4a17-9d4a-c6f025d175a6\",\"type\":\"None\",\"userAssignedIdentities\":{\"txilnerkujy\":{\"principalId\":\"4f4d8daf-9f71-44c5-ba07-b2172fb018a3\",\"clientId\":\"2421076f-59d0-4b0c-9893-f5e492a2ea38\"},\"eju\":{\"principalId\":\"5e7b6896-820d-42ee-bb9f-d596b1919f12\",\"clientId\":\"92a91233-d202-4ba9-989d-b036975c0d20\"},\"awrlyx\":{\"principalId\":\"bf808346-170c-4992-86a8-e44f9f227be1\",\"clientId\":\"e6ec8881-63f6-4bbc-99ae-c2e74353c994\"},\"cpr\":{\"principalId\":\"67c80dc7-9173-4dc8-be62-a43794323825\",\"clientId\":\"aff379ad-161b-4630-a4b8-5a5d9036999f\"}}}") + "{\"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()); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java index 54f98e50e52c2..9f9032b824866 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java @@ -6,44 +6,25 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class OperationsListMockTests { @Test public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"name\":\"qftiy\",\"isDataAction\":true,\"display\":{\"provider\":\"cqvyxlwhzlsico\",\"resource\":\"qqn\",\"operation\":\"lryav\",\"description\":\"heun\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java index 679ed0f949564..65044c2ed3952 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java @@ -6,44 +6,25 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class SenderUsernamesCreateOrUpdateWithResponseMockTests { @Test public void testCreateOrUpdateWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"properties\":{\"dataLocation\":\"vqtmnub\",\"username\":\"xkp\",\"displayName\":\"smond\",\"provisioningState\":\"Creating\"},\"id\":\"xvy\",\"name\":\"omgkopkwho\",\"type\":\"v\"}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java index 969433797168b..eda8fdb613a3a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java @@ -6,41 +6,22 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class SenderUsernamesDeleteWithResponseMockTests { @Test public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java index dd9c5f75869ee..1c4036c7fa645 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java @@ -6,44 +6,25 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class SenderUsernamesGetWithResponseMockTests { @Test public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"properties\":{\"dataLocation\":\"hfwdsjnkaljutiis\",\"username\":\"acffgdkzzewkfvhq\",\"displayName\":\"a\",\"provisioningState\":\"Updating\"},\"id\":\"n\",\"name\":\"pfuflrw\",\"type\":\"mh\"}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java index 6475b3d4ea16e..ee65618cbb759 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java @@ -6,45 +6,26 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; 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.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class SenderUsernamesListByDomainsMockTests { @Test public void testListByDomains() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"dataLocation\":\"tmuwlauwzi\",\"username\":\"xbmp\",\"displayName\":\"jefuzmuvpbttdumo\",\"provisioningState\":\"Succeeded\"},\"id\":\"ebmnzbtbhjpglk\",\"name\":\"gohdneuelfphsd\",\"type\":\"htozfikdow\"}]}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + 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)), diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java index 6d555ee7cf05e..93967146b85e8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java @@ -11,7 +11,7 @@ public final class UserAssignedIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { UserAssignedIdentity model = BinaryData.fromString( - "{\"principalId\":\"31004c3d-9ac5-4e79-bf00-0c50e42a2fdf\",\"clientId\":\"3f12c4e5-9bcd-457f-8bba-911e58c6db1d\"}") + "{\"principalId\":\"632ab1bf-45db-4df1-84fe-f5981607ca80\",\"clientId\":\"6b72f0bd-e503-4885-b8a5-a69c358d0389\"}") .toObject(UserAssignedIdentity.class); }