From b713b6dc1aaf6b82a7fb33f0caa87a9dc43e73c2 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:56:17 -0800 Subject: [PATCH] [Automation] Generate Fluent Lite from Swagger sphere#package-2024-04-01 (#43467) --- eng/versioning/version_client.txt | 2 +- .../azure-resourcemanager-sphere/CHANGELOG.md | 57 +++- .../azure-resourcemanager-sphere/README.md | 20 +- .../azure-resourcemanager-sphere/SAMPLE.md | 198 +++++++------ .../azure-resourcemanager-sphere/pom.xml | 3 +- .../sphere/AzureSphereManager.java | 6 +- .../sphere/fluent/models/CatalogInner.java | 104 ++++++- .../models/CertificateChainResponseInner.java | 45 ++- .../fluent/models/CertificateInner.java | 97 ++++++- .../models/CountDevicesResponseInner.java | 42 ++- .../sphere/fluent/models/DeploymentInner.java | 97 ++++++- .../fluent/models/DeviceGroupInner.java | 97 ++++++- .../sphere/fluent/models/DeviceInner.java | 97 ++++++- .../fluent/models/DeviceInsightInner.java | 113 ++++++-- .../sphere/fluent/models/ImageInner.java | 97 ++++++- .../sphere/fluent/models/OperationInner.java | 57 +++- .../sphere/fluent/models/ProductInner.java | 97 ++++++- .../ProofOfPossessionNonceResponseInner.java | 166 ++++++++++- .../SignedCapabilityImageResponseInner.java | 45 ++- .../AzureSphereMgmtClientImpl.java | 3 +- .../implementation/CatalogsClientImpl.java | 48 +--- .../CertificatesClientImpl.java | 8 +- .../implementation/DeploymentsClientImpl.java | 8 +- .../DeviceGroupsClientImpl.java | 8 +- .../implementation/DevicesClientImpl.java | 8 +- .../implementation/ImagesClientImpl.java | 8 +- .../implementation/OperationsClientImpl.java | 8 +- .../implementation/ProductsClientImpl.java | 16 +- .../implementation/ResourceManagerUtils.java | 2 - .../sphere/models/ActionType.java | 2 - .../models/AllowCrashDumpCollection.java | 2 - .../sphere/models/CapabilityType.java | 2 - .../sphere/models/CatalogListResult.java | 66 ++++- .../sphere/models/CatalogProperties.java | 47 ++- .../sphere/models/CatalogUpdate.java | 48 +++- .../sphere/models/CertificateListResult.java | 66 ++++- .../sphere/models/CertificateProperties.java | 143 +++++++++- .../sphere/models/CertificateStatus.java | 2 - .../sphere/models/ClaimDevicesRequest.java | 53 +++- .../sphere/models/CountDeviceResponse.java | 42 ++- .../sphere/models/CountElementsResponse.java | 46 ++- .../sphere/models/Deployment.java | 14 +- .../sphere/models/DeploymentListResult.java | 66 ++++- .../sphere/models/DeploymentProperties.java | 60 +++- .../sphere/models/DeviceGroupListResult.java | 66 ++++- .../sphere/models/DeviceGroupProperties.java | 72 ++++- .../sphere/models/DeviceGroupUpdate.java | 45 ++- .../models/DeviceGroupUpdateProperties.java | 65 ++++- .../sphere/models/DeviceListResult.java | 66 ++++- .../sphere/models/DeviceProperties.java | 66 ++++- .../sphere/models/DeviceUpdate.java | 45 ++- .../sphere/models/DeviceUpdateProperties.java | 45 ++- .../GenerateCapabilityImageRequest.java | 55 +++- .../resourcemanager/sphere/models/Image.java | 14 +- .../sphere/models/ImageListResult.java | 66 ++++- .../sphere/models/ImageProperties.java | 73 ++++- .../sphere/models/ImageType.java | 2 - .../models/ListDeviceGroupsRequest.java | 45 ++- .../sphere/models/OSFeedType.java | 2 - .../sphere/models/OperationDisplay.java | 65 ++++- .../sphere/models/OperationListResult.java | 52 +++- .../resourcemanager/sphere/models/Origin.java | 2 - .../sphere/models/PagedDeviceInsight.java | 66 ++++- .../sphere/models/ProductListResult.java | 66 ++++- .../sphere/models/ProductProperties.java | 48 +++- .../sphere/models/ProductUpdate.java | 45 ++- .../models/ProductUpdateProperties.java | 45 ++- .../models/ProofOfPossessionNonceRequest.java | 52 +++- .../sphere/models/ProvisioningState.java | 2 - .../sphere/models/RegionalDataBoundary.java | 2 - .../sphere/models/UpdatePolicy.java | 2 - .../src/main/java/module-info.java | 4 +- .../proxy-config.json | 2 +- .../reflect-config.json | 267 +----------------- .../CatalogsCreateOrUpdateSamples.java | 5 +- .../CatalogsGetByResourceGroupSamples.java | 4 +- .../CatalogsListDeploymentsSamples.java | 5 +- .../CatalogsListDeviceGroupsSamples.java | 7 +- .../CatalogsListDeviceInsightsSamples.java | 5 +- .../generated/CatalogsListDevicesSamples.java | 4 +- .../generated/CatalogsUploadImageSamples.java | 7 +- .../generated/CertificatesGetSamples.java | 4 +- .../CertificatesListByCatalogSamples.java | 4 +- .../CertificatesRetrieveCertChainSamples.java | 5 +- ...RetrieveProofOfPossessionNonceSamples.java | 7 +- .../DeploymentsCreateOrUpdateSamples.java | 6 +- .../generated/DeploymentsDeleteSamples.java | 5 +- .../generated/DeploymentsGetSamples.java | 5 +- .../DeploymentsListByDeviceGroupSamples.java | 5 +- .../DeviceGroupsClaimDevicesSamples.java | 9 +- .../DeviceGroupsCountDevicesSamples.java | 5 +- .../DeviceGroupsCreateOrUpdateSamples.java | 6 +- .../generated/DeviceGroupsDeleteSamples.java | 4 +- .../generated/DeviceGroupsGetSamples.java | 5 +- .../DeviceGroupsListByProductSamples.java | 5 +- .../generated/DeviceGroupsUpdateSamples.java | 6 +- .../DevicesCreateOrUpdateSamples.java | 8 +- .../generated/DevicesDeleteSamples.java | 7 +- ...DevicesGenerateCapabilityImageSamples.java | 11 +- .../sphere/generated/DevicesGetSamples.java | 7 +- .../DevicesListByDeviceGroupSamples.java | 5 +- .../generated/DevicesUpdateSamples.java | 9 +- .../ImagesCreateOrUpdateSamples.java | 6 +- .../sphere/generated/ImagesDeleteSamples.java | 5 +- .../sphere/generated/ImagesGetSamples.java | 5 +- .../generated/ImagesListByCatalogSamples.java | 4 +- .../ProductsCountDevicesSamples.java | 4 +- ...ctsGenerateDefaultDeviceGroupsSamples.java | 5 +- .../sphere/generated/ProductsGetSamples.java | 4 +- .../generated/CatalogListResultTests.java | 4 +- ...logsCountDevicesWithResponseMockTests.java | 25 +- .../CatalogsCreateOrUpdateMockTests.java | 25 +- .../generated/CatalogsDeleteMockTests.java | 25 +- ...tByResourceGroupWithResponseMockTests.java | 25 +- .../CatalogsListByResourceGroupMockTests.java | 25 +- .../CatalogsListDeploymentsMockTests.java | 25 +- .../CatalogsListDeviceGroupsMockTests.java | 25 +- .../CatalogsListDeviceInsightsMockTests.java | 25 +- .../CatalogsListDevicesMockTests.java | 25 +- .../generated/CatalogsListMockTests.java | 25 +- .../generated/CertificateListResultTests.java | 13 +- .../CertificatesGetWithResponseMockTests.java | 25 +- .../CertificatesListByCatalogMockTests.java | 25 +- ...etrieveCertChainWithResponseMockTests.java | 25 +- ...fPossessionNonceWithResponseMockTests.java | 25 +- .../generated/DeploymentListResultTests.java | 10 +- .../DeploymentsCreateOrUpdateMockTests.java | 25 +- .../generated/DeploymentsDeleteMockTests.java | 25 +- .../DeploymentsGetWithResponseMockTests.java | 25 +- ...DeploymentsListByDeviceGroupMockTests.java | 25 +- .../generated/DeviceGroupListResultTests.java | 5 +- ...oupsCountDevicesWithResponseMockTests.java | 25 +- .../DeviceGroupsCreateOrUpdateMockTests.java | 25 +- .../DeviceGroupsDeleteMockTests.java | 25 +- .../DeviceGroupsGetWithResponseMockTests.java | 25 +- .../DeviceGroupsListByProductMockTests.java | 25 +- .../generated/DeviceListResultTests.java | 5 +- .../DevicesCreateOrUpdateMockTests.java | 25 +- .../generated/DevicesDeleteMockTests.java | 25 +- ...vicesGenerateCapabilityImageMockTests.java | 25 +- .../DevicesGetWithResponseMockTests.java | 25 +- .../DevicesListByDeviceGroupMockTests.java | 25 +- .../generated/ImageListResultTests.java | 5 +- .../ImagesCreateOrUpdateMockTests.java | 25 +- .../generated/ImagesDeleteMockTests.java | 25 +- .../ImagesGetWithResponseMockTests.java | 25 +- .../ImagesListByCatalogMockTests.java | 25 +- .../generated/OperationsListMockTests.java | 25 +- .../generated/PagedDeviceInsightTests.java | 5 +- .../generated/ProductListResultTests.java | 8 +- ...uctsCountDevicesWithResponseMockTests.java | 25 +- .../ProductsCreateOrUpdateMockTests.java | 25 +- .../generated/ProductsDeleteMockTests.java | 25 +- ...sGenerateDefaultDeviceGroupsMockTests.java | 25 +- .../ProductsGetWithResponseMockTests.java | 25 +- .../ProductsListByCatalogMockTests.java | 25 +- 156 files changed, 3233 insertions(+), 1658 deletions(-) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 5f67b49c60661..c16b58ef7fa9a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -445,7 +445,7 @@ com.azure.resourcemanager:azure-resourcemanager-managementgroups;1.0.0-beta.2;1. com.azure.resourcemanager:azure-resourcemanager-managednetworkfabric;1.1.0;1.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-iotfirmwaredefense;1.0.0;1.1.0 com.azure.resourcemanager:azure-resourcemanager-quantum;1.0.0-beta.3;1.0.0-beta.4 -com.azure.resourcemanager:azure-resourcemanager-sphere;1.0.0;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-sphere;1.0.0;1.1.0 com.azure.resourcemanager:azure-resourcemanager-chaos;1.1.0;1.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-defendereasm;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-hdinsight-containers;1.0.0-beta.3;1.0.0-beta.4 diff --git a/sdk/sphere/azure-resourcemanager-sphere/CHANGELOG.md b/sdk/sphere/azure-resourcemanager-sphere/CHANGELOG.md index 5a13d46e2c228..c8de466369cdd 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/CHANGELOG.md +++ b/sdk/sphere/azure-resourcemanager-sphere/CHANGELOG.md @@ -1,14 +1,63 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0 (2024-12-19) -### Features Added +- Azure Resource Manager AzureSphere client library for Java. This package contains Microsoft Azure SDK for AzureSphere Management SDK. Azure Sphere resource management API. Package tag package-2024-04-01. 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 + +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()); +``` + +### Features Added + +#### `models.ImageListResult` was modified + +* `withNextLink(java.lang.String)` was added + +#### `models.PagedDeviceInsight` was modified + +* `withNextLink(java.lang.String)` was added + +#### `models.DeviceGroupListResult` was modified + +* `withNextLink(java.lang.String)` was added + +#### `models.DeploymentListResult` was modified + +* `withNextLink(java.lang.String)` was added + +#### `models.ProductListResult` was modified + +* `withNextLink(java.lang.String)` was added + +#### `models.CatalogListResult` was modified + +* `withNextLink(java.lang.String)` was added + +#### `models.DeviceListResult` was modified + +* `withNextLink(java.lang.String)` was added + +#### `models.Image$Update` was modified -### Other Changes +* `withProperties(models.ImageProperties)` was added + +#### `models.CertificateListResult` was modified + +* `withNextLink(java.lang.String)` was added + +#### `models.Deployment$Update` was modified + +* `withProperties(models.DeploymentProperties)` was added ## 1.0.0 (2024-03-26) diff --git a/sdk/sphere/azure-resourcemanager-sphere/README.md b/sdk/sphere/azure-resourcemanager-sphere/README.md index 8918acb6fd371..7041a19d3c92e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/README.md +++ b/sdk/sphere/azure-resourcemanager-sphere/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-sphere - 1.0.0 + 1.1.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); @@ -74,6 +70,13 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +```java +catalog = azureSphereManager.catalogs() + .define(catalogName) + .withRegion(REGION_GLOBAL) + .withExistingResourceGroup(resourceGroupName) + .create(); +``` [Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/sphere/azure-resourcemanager-sphere/SAMPLE.md) @@ -97,6 +100,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/sphere/azure-resourcemanager-sphere/SAMPLE.md b/sdk/sphere/azure-resourcemanager-sphere/SAMPLE.md index 0f9c9ae9fc3c8..7327f883c4150 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/SAMPLE.md +++ b/sdk/sphere/azure-resourcemanager-sphere/SAMPLE.md @@ -109,7 +109,10 @@ public final class CatalogsCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().define("MyCatalog1").withRegion("global").withExistingResourceGroup("MyResourceGroup1") + manager.catalogs() + .define("MyCatalog1") + .withRegion("global") + .withExistingResourceGroup("MyResourceGroup1") .create(); } } @@ -154,8 +157,8 @@ public final class CatalogsGetByResourceGroupSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().getByResourceGroupWithResponse("MyResourceGroup1", "MyCatalog1", - com.azure.core.util.Context.NONE); + manager.catalogs() + .getByResourceGroupWithResponse("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); } } ``` @@ -221,8 +224,9 @@ public final class CatalogsListDeploymentsSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsListDeployments(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().listDeployments("MyResourceGroup1", "MyCatalog1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.catalogs() + .listDeployments("MyResourceGroup1", "MyCatalog1", null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` @@ -246,9 +250,10 @@ public final class CatalogsListDeviceGroupsSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsListDeviceGroups(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().listDeviceGroups("MyResourceGroup1", "MyCatalog1", - new ListDeviceGroupsRequest().withDeviceGroupName("MyDeviceGroup1"), null, null, null, null, - com.azure.core.util.Context.NONE); + manager.catalogs() + .listDeviceGroups("MyResourceGroup1", "MyCatalog1", + new ListDeviceGroupsRequest().withDeviceGroupName("MyDeviceGroup1"), null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` @@ -270,8 +275,9 @@ public final class CatalogsListDeviceInsightsSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsListDeviceInsights(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().listDeviceInsights("MyResourceGroup1", "MyCatalog1", null, 10, null, null, - com.azure.core.util.Context.NONE); + manager.catalogs() + .listDeviceInsights("MyResourceGroup1", "MyCatalog1", null, 10, null, null, + com.azure.core.util.Context.NONE); } } ``` @@ -294,8 +300,8 @@ public final class CatalogsListDevicesSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsListDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().listDevices("MyResourceGroup1", "MyCatalog1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.catalogs() + .listDevices("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); } } ``` @@ -348,9 +354,10 @@ public final class CatalogsUploadImageSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsUploadImage(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().uploadImage("MyResourceGroup1", "MyCatalog1", - new ImageInner().withProperties(new ImageProperties().withImage("bXliYXNlNjRzdHJpbmc=")), - com.azure.core.util.Context.NONE); + manager.catalogs() + .uploadImage("MyResourceGroup1", "MyCatalog1", + new ImageInner().withProperties(new ImageProperties().withImage("bXliYXNlNjRzdHJpbmc=")), + com.azure.core.util.Context.NONE); } } ``` @@ -372,8 +379,8 @@ public final class CertificatesGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void certificatesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.certificates().getWithResponse("MyResourceGroup1", "MyCatalog1", "default", - com.azure.core.util.Context.NONE); + manager.certificates() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "default", com.azure.core.util.Context.NONE); } } ``` @@ -395,8 +402,8 @@ public final class CertificatesListByCatalogSamples { * @param manager Entry point to AzureSphereManager. */ public static void certificatesListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.certificates().listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.certificates() + .listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); } } ``` @@ -418,8 +425,9 @@ public final class CertificatesRetrieveCertChainSamples { * @param manager Entry point to AzureSphereManager. */ public static void certificatesRetrieveCertChain(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.certificates().retrieveCertChainWithResponse("MyResourceGroup1", "MyCatalog1", "active", - com.azure.core.util.Context.NONE); + manager.certificates() + .retrieveCertChainWithResponse("MyResourceGroup1", "MyCatalog1", "active", + com.azure.core.util.Context.NONE); } } ``` @@ -444,9 +452,10 @@ public final class CertificatesRetrieveProofOfPossessionNonceSamples { */ public static void certificatesRetrieveProofOfPossessionNonce(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.certificates().retrieveProofOfPossessionNonceWithResponse("MyResourceGroup1", "MyCatalog1", "active", - new ProofOfPossessionNonceRequest().withProofOfPossessionNonce("proofOfPossessionNonce"), - com.azure.core.util.Context.NONE); + manager.certificates() + .retrieveProofOfPossessionNonceWithResponse("MyResourceGroup1", "MyCatalog1", "active", + new ProofOfPossessionNonceRequest().withProofOfPossessionNonce("proofOfPossessionNonce"), + com.azure.core.util.Context.NONE); } } ``` @@ -468,8 +477,10 @@ public final class DeploymentsCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void deploymentsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deployments().define("MyDeployment1") - .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1").create(); + manager.deployments() + .define("MyDeployment1") + .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1") + .create(); } } ``` @@ -491,8 +502,9 @@ public final class DeploymentsDeleteSamples { * @param manager Entry point to AzureSphereManager. */ public static void deploymentsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deployments().delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", - "MyDeploymentName1", com.azure.core.util.Context.NONE); + manager.deployments() + .delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", "MyDeploymentName1", + com.azure.core.util.Context.NONE); } } ``` @@ -514,8 +526,9 @@ public final class DeploymentsGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void deploymentsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deployments().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", - "MyDeployment1", com.azure.core.util.Context.NONE); + manager.deployments() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "MyDeployment1", + com.azure.core.util.Context.NONE); } } ``` @@ -537,8 +550,9 @@ public final class DeploymentsListByDeviceGroupSamples { * @param manager Entry point to AzureSphereManager. */ public static void deploymentsListByDeviceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deployments().listByDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", null, - null, null, null, com.azure.core.util.Context.NONE); + manager.deployments() + .listByDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` @@ -563,10 +577,11 @@ public final class DeviceGroupsClaimDevicesSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsClaimDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().claimDevices("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", - new ClaimDevicesRequest().withDeviceIdentifiers(Arrays.asList( - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")), - com.azure.core.util.Context.NONE); + manager.deviceGroups() + .claimDevices("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + new ClaimDevicesRequest().withDeviceIdentifiers(Arrays.asList( + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")), + com.azure.core.util.Context.NONE); } } ``` @@ -588,8 +603,9 @@ public final class DeviceGroupsCountDevicesSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - "MyDeviceGroup1", com.azure.core.util.Context.NONE); + manager.deviceGroups() + .countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + com.azure.core.util.Context.NONE); } } ``` @@ -615,10 +631,12 @@ public final class DeviceGroupsCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().define("MyDeviceGroup1") + manager.deviceGroups() + .define("MyDeviceGroup1") .withExistingProduct("MyResourceGroup1", "MyCatalog1", "MyProduct1") .withProperties(new DeviceGroupProperties().withDescription("Description for MyDeviceGroup1") - .withOsFeedType(OSFeedType.RETAIL).withUpdatePolicy(UpdatePolicy.UPDATE_ALL)) + .withOsFeedType(OSFeedType.RETAIL) + .withUpdatePolicy(UpdatePolicy.UPDATE_ALL)) .create(); } } @@ -641,8 +659,8 @@ public final class DeviceGroupsDeleteSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().delete("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", - com.azure.core.util.Context.NONE); + manager.deviceGroups() + .delete("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE); } } ``` @@ -664,8 +682,9 @@ public final class DeviceGroupsGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", - com.azure.core.util.Context.NONE); + manager.deviceGroups() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + com.azure.core.util.Context.NONE); } } ``` @@ -687,8 +706,9 @@ public final class DeviceGroupsListByProductSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsListByProduct(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().listByProduct("MyResourceGroup1", "MyCatalog1", "MyProduct1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.deviceGroups() + .listByProduct("MyResourceGroup1", "MyCatalog1", "MyProduct1", null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` @@ -712,8 +732,10 @@ public final class DeviceGroupsUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - DeviceGroup resource = manager.deviceGroups().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - "MyDeviceGroup1", com.azure.core.util.Context.NONE).getValue(); + DeviceGroup resource = manager.deviceGroups() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } @@ -736,9 +758,11 @@ public final class DevicesCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().define( - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") - .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1").create(); + manager.devices() + .define( + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") + .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1") + .create(); } } ``` @@ -760,9 +784,10 @@ public final class DevicesDeleteSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - com.azure.core.util.Context.NONE); + manager.devices() + .delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -788,11 +813,12 @@ public final class DevicesGenerateCapabilityImageSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesGenerateCapabilityImage(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().generateCapabilityImage("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - new GenerateCapabilityImageRequest().withCapabilities( - Arrays.asList(CapabilityType.APPLICATION_DEVELOPMENT)), - com.azure.core.util.Context.NONE); + manager.devices() + .generateCapabilityImage("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + new GenerateCapabilityImageRequest().withCapabilities( + Arrays.asList(CapabilityType.APPLICATION_DEVELOPMENT)), + com.azure.core.util.Context.NONE); } } ``` @@ -814,9 +840,10 @@ public final class DevicesGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - com.azure.core.util.Context.NONE); + manager.devices() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -838,8 +865,9 @@ public final class DevicesListByDeviceGroupSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesListByDeviceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().listByDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", - com.azure.core.util.Context.NONE); + manager.devices() + .listByDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", + com.azure.core.util.Context.NONE); } } ``` @@ -863,10 +891,11 @@ public final class DevicesUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - Device resource = manager.devices().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - "MyDeviceGroup1", - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - com.azure.core.util.Context.NONE).getValue(); + Device resource = manager.devices() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } @@ -891,9 +920,11 @@ public final class ImagesCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void imageCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.images().define("00000000-0000-0000-0000-000000000000") + manager.images() + .define("00000000-0000-0000-0000-000000000000") .withExistingCatalog("MyResourceGroup1", "MyCatalog1") - .withProperties(new ImageProperties().withImage("bXliYXNlNjRzdHJpbmc=")).create(); + .withProperties(new ImageProperties().withImage("bXliYXNlNjRzdHJpbmc=")) + .create(); } } ``` @@ -915,8 +946,9 @@ public final class ImagesDeleteSamples { * @param manager Entry point to AzureSphereManager. */ public static void imagesDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.images().delete("MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", - com.azure.core.util.Context.NONE); + manager.images() + .delete("MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -938,8 +970,9 @@ public final class ImagesGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void imagesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.images().getWithResponse("MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", - com.azure.core.util.Context.NONE); + manager.images() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -961,8 +994,8 @@ public final class ImagesListByCatalogSamples { * @param manager Entry point to AzureSphereManager. */ public static void imagesListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.images().listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.images() + .listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); } } ``` @@ -1007,8 +1040,8 @@ public final class ProductsCountDevicesSamples { * @param manager Entry point to AzureSphereManager. */ public static void productsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.products().countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - com.azure.core.util.Context.NONE); + manager.products() + .countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); } } ``` @@ -1075,8 +1108,9 @@ public final class ProductsGenerateDefaultDeviceGroupsSamples { */ public static void productsGenerateDefaultDeviceGroups(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.products().generateDefaultDeviceGroups("MyResourceGroup1", "MyCatalog1", "MyProduct1", - com.azure.core.util.Context.NONE); + manager.products() + .generateDefaultDeviceGroups("MyResourceGroup1", "MyCatalog1", "MyProduct1", + com.azure.core.util.Context.NONE); } } ``` @@ -1098,8 +1132,8 @@ public final class ProductsGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void productsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.products().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - com.azure.core.util.Context.NONE); + manager.products() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/sphere/azure-resourcemanager-sphere/pom.xml b/sdk/sphere/azure-resourcemanager-sphere/pom.xml index 743466d9cd720..ca36893030758 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/pom.xml +++ b/sdk/sphere/azure-resourcemanager-sphere/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-sphere - 1.1.0-beta.1 + 1.1.0 jar Microsoft Azure SDK for AzureSphere Management @@ -45,6 +45,7 @@ UTF-8 0 0 + false diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/AzureSphereManager.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/AzureSphereManager.java index 0cbd6acaa01b6..63706a02bbb7c 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/AzureSphereManager.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/AzureSphereManager.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; @@ -233,7 +233,7 @@ public AzureSphereManager authenticate(TokenCredential credential, AzureProfile .append("-") .append("com.azure.resourcemanager.sphere") .append("/") - .append("1.0.0"); + .append("1.1.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -266,7 +266,7 @@ public AzureSphereManager authenticate(TokenCredential credential, AzureProfile 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogInner.java index ccedd272070fc..298890c77e258 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogInner.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.sphere.models.CatalogProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -19,15 +22,28 @@ public final class CatalogInner extends Resource { /* * The resource-specific properties for this resource. */ - @JsonProperty(value = "properties") private CatalogProperties properties; /* * 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 CatalogInner class. */ @@ -63,6 +79,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} */ @@ -91,4 +137,56 @@ public void validate() { properties().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.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CatalogInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CatalogInner 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 CatalogInner. + */ + public static CatalogInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CatalogInner deserializedCatalogInner = new CatalogInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCatalogInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCatalogInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCatalogInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCatalogInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCatalogInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCatalogInner.properties = CatalogProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCatalogInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCatalogInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateChainResponseInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateChainResponseInner.java index 645198a6ac0db..8926263a40053 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateChainResponseInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateChainResponseInner.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.sphere.fluent.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; /** * The certificate chain response. */ @Immutable -public final class CertificateChainResponseInner { +public final class CertificateChainResponseInner implements JsonSerializable { /* * The certificate chain. */ - @JsonProperty(value = "certificateChain", access = JsonProperty.Access.WRITE_ONLY) private String certificateChain; /** @@ -40,4 +43,40 @@ public String certificateChain() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CertificateChainResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CertificateChainResponseInner 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 CertificateChainResponseInner. + */ + public static CertificateChainResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CertificateChainResponseInner deserializedCertificateChainResponseInner + = new CertificateChainResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("certificateChain".equals(fieldName)) { + deserializedCertificateChainResponseInner.certificateChain = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCertificateChainResponseInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateInner.java index 8cb6c15c3e929..5a728bbf8138e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateInner.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.sphere.models.CertificateProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * An certificate resource belonging to a catalog resource. @@ -18,15 +21,28 @@ public final class CertificateInner extends ProxyResource { /* * The resource-specific properties for this resource. */ - @JsonProperty(value = "properties") private CertificateProperties properties; /* * 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 CertificateInner class. */ @@ -62,6 +78,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; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CertificateInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CertificateInner 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 CertificateInner. + */ + public static CertificateInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CertificateInner deserializedCertificateInner = new CertificateInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCertificateInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCertificateInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCertificateInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCertificateInner.properties = CertificateProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCertificateInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCertificateInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CountDevicesResponseInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CountDevicesResponseInner.java index 04b3280e7b55e..d20df34bf46f3 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CountDevicesResponseInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CountDevicesResponseInner.java @@ -5,7 +5,11 @@ package com.azure.resourcemanager.sphere.fluent.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.sphere.models.CountElementsResponse; +import java.io.IOException; /** * Response to the action call for count devices in a catalog. @@ -34,6 +38,42 @@ public CountDevicesResponseInner withValue(int value) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("value", value()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CountDevicesResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CountDevicesResponseInner 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 CountDevicesResponseInner. + */ + public static CountDevicesResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CountDevicesResponseInner deserializedCountDevicesResponseInner = new CountDevicesResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedCountDevicesResponseInner.withValue(reader.getInt()); + } else { + reader.skipChildren(); + } + } + + return deserializedCountDevicesResponseInner; + }); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentInner.java index cc20d198b15b6..18c3583a831d3 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentInner.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.sphere.models.DeploymentProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * An deployment resource belonging to a device group resource. @@ -18,15 +21,28 @@ public final class DeploymentInner extends ProxyResource { /* * The resource-specific properties for this resource. */ - @JsonProperty(value = "properties") private DeploymentProperties properties; /* * 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 DeploymentInner class. */ @@ -62,6 +78,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; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeploymentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeploymentInner 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 DeploymentInner. + */ + public static DeploymentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeploymentInner deserializedDeploymentInner = new DeploymentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDeploymentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDeploymentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDeploymentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDeploymentInner.properties = DeploymentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDeploymentInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeploymentInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupInner.java index 5bce6f135bb14..0e370baf7483d 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupInner.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.sphere.models.DeviceGroupProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * An device group resource belonging to a product resource. @@ -18,15 +21,28 @@ public final class DeviceGroupInner extends ProxyResource { /* * The resource-specific properties for this resource. */ - @JsonProperty(value = "properties") private DeviceGroupProperties properties; /* * 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 DeviceGroupInner class. */ @@ -62,6 +78,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; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceGroupInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceGroupInner 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 DeviceGroupInner. + */ + public static DeviceGroupInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceGroupInner deserializedDeviceGroupInner = new DeviceGroupInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDeviceGroupInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDeviceGroupInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDeviceGroupInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDeviceGroupInner.properties = DeviceGroupProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDeviceGroupInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceGroupInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInner.java index 5e37559821520..58b645948359e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInner.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.sphere.models.DeviceProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * An device resource belonging to a device group resource. @@ -18,15 +21,28 @@ public final class DeviceInner extends ProxyResource { /* * The resource-specific properties for this resource. */ - @JsonProperty(value = "properties") private DeviceProperties properties; /* * 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 DeviceInner class. */ @@ -62,6 +78,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; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceInner 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 DeviceInner. + */ + public static DeviceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceInner deserializedDeviceInner = new DeviceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDeviceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDeviceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDeviceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDeviceInner.properties = DeviceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDeviceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInsightInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInsightInner.java index 26e8172ee6491..be4027abc0c2e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInsightInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInsightInner.java @@ -5,61 +5,59 @@ package com.azure.resourcemanager.sphere.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; 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; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Device insight report. */ @Fluent -public final class DeviceInsightInner { +public final class DeviceInsightInner implements JsonSerializable { /* * Device ID */ - @JsonProperty(value = "deviceId", required = true) private String deviceId; /* * Event description */ - @JsonProperty(value = "description", required = true) private String description; /* * Event start timestamp */ - @JsonProperty(value = "startTimestampUtc", required = true) private OffsetDateTime startTimestampUtc; /* * Event end timestamp */ - @JsonProperty(value = "endTimestampUtc", required = true) private OffsetDateTime endTimestampUtc; /* * Event category */ - @JsonProperty(value = "eventCategory", required = true) private String eventCategory; /* * Event class */ - @JsonProperty(value = "eventClass", required = true) private String eventClass; /* * Event type */ - @JsonProperty(value = "eventType", required = true) private String eventType; /* * Event count */ - @JsonProperty(value = "eventCount", required = true) private int eventCount; /** @@ -235,34 +233,101 @@ public DeviceInsightInner withEventCount(int eventCount) { */ public void validate() { if (deviceId() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property deviceId in model DeviceInsightInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property deviceId in model DeviceInsightInner")); } if (description() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property description in model DeviceInsightInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property description in model DeviceInsightInner")); } if (startTimestampUtc() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property startTimestampUtc in model DeviceInsightInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property startTimestampUtc in model DeviceInsightInner")); } if (endTimestampUtc() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property endTimestampUtc in model DeviceInsightInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property endTimestampUtc in model DeviceInsightInner")); } if (eventCategory() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property eventCategory in model DeviceInsightInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property eventCategory in model DeviceInsightInner")); } if (eventClass() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property eventClass in model DeviceInsightInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property eventClass in model DeviceInsightInner")); } if (eventType() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property eventType in model DeviceInsightInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property eventType in model DeviceInsightInner")); } } private static final ClientLogger LOGGER = new ClientLogger(DeviceInsightInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deviceId", this.deviceId); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("startTimestampUtc", + this.startTimestampUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTimestampUtc)); + jsonWriter.writeStringField("endTimestampUtc", + this.endTimestampUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTimestampUtc)); + jsonWriter.writeStringField("eventCategory", this.eventCategory); + jsonWriter.writeStringField("eventClass", this.eventClass); + jsonWriter.writeStringField("eventType", this.eventType); + jsonWriter.writeIntField("eventCount", this.eventCount); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceInsightInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceInsightInner 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 DeviceInsightInner. + */ + public static DeviceInsightInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceInsightInner deserializedDeviceInsightInner = new DeviceInsightInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceId".equals(fieldName)) { + deserializedDeviceInsightInner.deviceId = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedDeviceInsightInner.description = reader.getString(); + } else if ("startTimestampUtc".equals(fieldName)) { + deserializedDeviceInsightInner.startTimestampUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTimestampUtc".equals(fieldName)) { + deserializedDeviceInsightInner.endTimestampUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("eventCategory".equals(fieldName)) { + deserializedDeviceInsightInner.eventCategory = reader.getString(); + } else if ("eventClass".equals(fieldName)) { + deserializedDeviceInsightInner.eventClass = reader.getString(); + } else if ("eventType".equals(fieldName)) { + deserializedDeviceInsightInner.eventType = reader.getString(); + } else if ("eventCount".equals(fieldName)) { + deserializedDeviceInsightInner.eventCount = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceInsightInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageInner.java index d7bb5032b0f7a..a59c2c55eb7dc 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageInner.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.sphere.models.ImageProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * An image resource belonging to a catalog resource. @@ -18,15 +21,28 @@ public final class ImageInner extends ProxyResource { /* * The resource-specific properties for this resource. */ - @JsonProperty(value = "properties") private ImageProperties properties; /* * 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 ImageInner class. */ @@ -62,6 +78,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; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImageInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImageInner 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 ImageInner. + */ + public static ImageInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImageInner deserializedImageInner = new ImageInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedImageInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedImageInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedImageInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedImageInner.properties = ImageProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedImageInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedImageInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/OperationInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/OperationInner.java index dfc05b47ebf82..cf31d45eac8ab 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/OperationInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/OperationInner.java @@ -5,10 +5,14 @@ package com.azure.resourcemanager.sphere.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.sphere.models.ActionType; import com.azure.resourcemanager.sphere.models.OperationDisplay; import com.azure.resourcemanager.sphere.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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductInner.java index a4bb450d3b9a4..67ceee12ae2c4 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductInner.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.sphere.models.ProductProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * An product resource belonging to a catalog resource. @@ -18,15 +21,28 @@ public final class ProductInner extends ProxyResource { /* * The resource-specific properties for this resource. */ - @JsonProperty(value = "properties") private ProductProperties properties; /* * 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 ProductInner class. */ @@ -62,6 +78,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; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductInner 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 ProductInner. + */ + public static ProductInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductInner deserializedProductInner = new ProductInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProductInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProductInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProductInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedProductInner.properties = ProductProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedProductInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProductInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProofOfPossessionNonceResponseInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProofOfPossessionNonceResponseInner.java index a1582786030f5..c995d548b5fa1 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProofOfPossessionNonceResponseInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProofOfPossessionNonceResponseInner.java @@ -5,19 +5,132 @@ package com.azure.resourcemanager.sphere.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.sphere.models.CertificateProperties; +import com.azure.resourcemanager.sphere.models.CertificateStatus; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import java.io.IOException; +import java.time.OffsetDateTime; /** * Result of the action to generate a proof of possession nonce. */ @Immutable public final class ProofOfPossessionNonceResponseInner extends CertificateProperties { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The certificate not before date. + */ + private OffsetDateTime notBeforeUtc; + + /* + * The certificate expiry date. + */ + private OffsetDateTime expiryUtc; + + /* + * The certificate thumbprint. + */ + private String thumbprint; + + /* + * The certificate subject. + */ + private String subject; + + /* + * The certificate status. + */ + private CertificateStatus status; + + /* + * The certificate as a UTF-8 encoded base 64 string. + */ + private String certificate; + /** * Creates an instance of ProofOfPossessionNonceResponseInner class. */ public ProofOfPossessionNonceResponseInner() { } + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + @Override + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the notBeforeUtc property: The certificate not before date. + * + * @return the notBeforeUtc value. + */ + @Override + public OffsetDateTime notBeforeUtc() { + return this.notBeforeUtc; + } + + /** + * Get the expiryUtc property: The certificate expiry date. + * + * @return the expiryUtc value. + */ + @Override + public OffsetDateTime expiryUtc() { + return this.expiryUtc; + } + + /** + * Get the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + @Override + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the subject property: The certificate subject. + * + * @return the subject value. + */ + @Override + public String subject() { + return this.subject; + } + + /** + * Get the status property: The certificate status. + * + * @return the status value. + */ + @Override + public CertificateStatus status() { + return this.status; + } + + /** + * Get the certificate property: The certificate as a UTF-8 encoded base 64 string. + * + * @return the certificate value. + */ + @Override + public String certificate() { + return this.certificate; + } + /** * Validates the instance. * @@ -25,6 +138,57 @@ public ProofOfPossessionNonceResponseInner() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProofOfPossessionNonceResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProofOfPossessionNonceResponseInner 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 ProofOfPossessionNonceResponseInner. + */ + public static ProofOfPossessionNonceResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProofOfPossessionNonceResponseInner deserializedProofOfPossessionNonceResponseInner + = new ProofOfPossessionNonceResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("certificate".equals(fieldName)) { + deserializedProofOfPossessionNonceResponseInner.certificate = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedProofOfPossessionNonceResponseInner.status + = CertificateStatus.fromString(reader.getString()); + } else if ("subject".equals(fieldName)) { + deserializedProofOfPossessionNonceResponseInner.subject = reader.getString(); + } else if ("thumbprint".equals(fieldName)) { + deserializedProofOfPossessionNonceResponseInner.thumbprint = reader.getString(); + } else if ("expiryUtc".equals(fieldName)) { + deserializedProofOfPossessionNonceResponseInner.expiryUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("notBeforeUtc".equals(fieldName)) { + deserializedProofOfPossessionNonceResponseInner.notBeforeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedProofOfPossessionNonceResponseInner.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedProofOfPossessionNonceResponseInner; + }); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/SignedCapabilityImageResponseInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/SignedCapabilityImageResponseInner.java index e493a98d9a8e7..5820b3f23246c 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/SignedCapabilityImageResponseInner.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/SignedCapabilityImageResponseInner.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.sphere.fluent.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; /** * Signed device capability image response. */ @Immutable -public final class SignedCapabilityImageResponseInner { +public final class SignedCapabilityImageResponseInner implements JsonSerializable { /* * The signed device capability image as a UTF-8 encoded base 64 string. */ - @JsonProperty(value = "image", access = JsonProperty.Access.WRITE_ONLY) private String image; /** @@ -40,4 +43,40 @@ public String image() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SignedCapabilityImageResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SignedCapabilityImageResponseInner 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 SignedCapabilityImageResponseInner. + */ + public static SignedCapabilityImageResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SignedCapabilityImageResponseInner deserializedSignedCapabilityImageResponseInner + = new SignedCapabilityImageResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("image".equals(fieldName)) { + deserializedSignedCapabilityImageResponseInner.image = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSignedCapabilityImageResponseInner; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereMgmtClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereMgmtClientImpl.java index 1e579b4df28b2..51d87189e728b 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereMgmtClientImpl.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereMgmtClientImpl.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.sphere.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; @@ -371,7 +372,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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsClientImpl.java index 2c20fb1e1cb77..b6dd7624202a5 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsClientImpl.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsClientImpl.java @@ -2320,9 +2320,7 @@ public void uploadImage(String resourceGroupName, String catalogName, ImageInner /** * 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. @@ -2350,9 +2348,7 @@ private Mono> listBySubscriptionNextSinglePageAsync( /** * 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. @@ -2379,9 +2375,7 @@ private Mono> listBySubscriptionNextSinglePageAsync( /** * 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. @@ -2409,9 +2403,7 @@ private Mono> listByResourceGroupNextSinglePageAsync /** * 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. @@ -2438,9 +2430,7 @@ private Mono> listByResourceGroupNextSinglePageAsync /** * 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. @@ -2467,9 +2457,7 @@ private Mono> listDeploymentsNextSinglePageAsync( /** * 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. @@ -2496,9 +2484,7 @@ private Mono> listDeploymentsNextSinglePageAsync( /** * 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. @@ -2525,9 +2511,7 @@ private Mono> listDeviceGroupsNextSinglePageAsyn /** * 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. @@ -2555,9 +2539,7 @@ private Mono> listDeviceGroupsNextSinglePageAsyn /** * 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. @@ -2585,9 +2567,7 @@ private Mono> listDeviceInsightsNextSinglePage /** * 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. @@ -2615,9 +2595,7 @@ private Mono> listDeviceInsightsNextSinglePage /** * 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. @@ -2644,9 +2622,7 @@ private Mono> listDevicesNextSinglePageAsync(String n /** * 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesClientImpl.java index 0aef1cf556fa3..8685fddfedeb5 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesClientImpl.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesClientImpl.java @@ -728,9 +728,7 @@ public ProofOfPossessionNonceResponseInner retrieveProofOfPossessionNonce(String /** * 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. @@ -757,9 +755,7 @@ private Mono> listByCatalogNextSinglePageAsync(S /** * 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsClientImpl.java index 74ba3f6b7317c..d6f4cecb3b036 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsClientImpl.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsClientImpl.java @@ -1132,9 +1132,7 @@ public void delete(String resourceGroupName, String catalogName, String productN /** * 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. @@ -1161,9 +1159,7 @@ private Mono> listByDeviceGroupNextSinglePageAsyn /** * 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsClientImpl.java index 761893d087d64..c1d966d5bebdb 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsClientImpl.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsClientImpl.java @@ -1785,9 +1785,7 @@ public CountDevicesResponseInner countDevices(String resourceGroupName, String c /** * 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. @@ -1814,9 +1812,7 @@ private Mono> listByProductNextSinglePageAsync(S /** * 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesClientImpl.java index 3ea49e09d36dc..7e559e5c1b0e9 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesClientImpl.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesClientImpl.java @@ -1685,9 +1685,7 @@ public SignedCapabilityImageResponseInner generateCapabilityImage(String resourc /** * 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. @@ -1714,9 +1712,7 @@ private Mono> listByDeviceGroupNextSinglePageAsync(St /** * 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesClientImpl.java index c6c1aa74e5aec..8861c167c788d 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesClientImpl.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesClientImpl.java @@ -912,9 +912,7 @@ public void delete(String resourceGroupName, String catalogName, String imageNam /** * 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. @@ -941,9 +939,7 @@ private Mono> listByCatalogNextSinglePageAsync(String /** * 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsClientImpl.java index 5ddb4fe50d7ca..eae41a5cbab2a 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsClientImpl.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsClientImpl.java @@ -183,9 +183,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. @@ -211,9 +209,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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsClientImpl.java index 9034a2b7a033c..05dd6d79d4f5f 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsClientImpl.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsClientImpl.java @@ -1453,9 +1453,7 @@ public PagedIterable generateDefaultDeviceGroups(String resour /** * 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. @@ -1482,9 +1480,7 @@ private Mono> listByCatalogNextSinglePageAsync(Strin /** * 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. @@ -1511,9 +1507,7 @@ private Mono> listByCatalogNextSinglePageAsync(Strin /** * 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. @@ -1540,9 +1534,7 @@ private Mono> generateDefaultDeviceGroupsNextSin /** * 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ResourceManagerUtils.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ResourceManagerUtils.java index a0c9f67958a66..53ffe8656ceb2 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ResourceManagerUtils.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ActionType.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ActionType.java index 8a331ea51dcfc..66657e6c9262f 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ActionType.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ActionType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/AllowCrashDumpCollection.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/AllowCrashDumpCollection.java index 3fb7732e3328e..0381a3385b740 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/AllowCrashDumpCollection.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/AllowCrashDumpCollection.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public AllowCrashDumpCollection() { * @param name a name to look for. * @return the corresponding AllowCrashDumpCollection. */ - @JsonCreator public static AllowCrashDumpCollection fromString(String name) { return fromString(name, AllowCrashDumpCollection.class); } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CapabilityType.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CapabilityType.java index a3f2ec5709f2e..8c60c8b3d3bda 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CapabilityType.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CapabilityType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public CapabilityType() { * @param name a name to look for. * @return the corresponding CapabilityType. */ - @JsonCreator public static CapabilityType fromString(String name) { return fromString(name, CapabilityType.class); } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogListResult.java index 2af7d44df5d3b..edd39c17852b3 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogListResult.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogListResult.java @@ -6,25 +6,27 @@ 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.sphere.fluent.models.CatalogInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The response of a Catalog list operation. */ @Fluent -public final class CatalogListResult { +public final class CatalogListResult implements JsonSerializable { /* * The Catalog items on this page */ - @JsonProperty(value = "value", required = true) private List value; /* * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,6 +64,17 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CatalogListResult object itself. + */ + public CatalogListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * @@ -69,12 +82,53 @@ public String nextLink() { */ public void validate() { if (value() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property value in model CatalogListResult")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model CatalogListResult")); } else { value().forEach(e -> e.validate()); } } private static final ClientLogger LOGGER = new ClientLogger(CatalogListResult.class); + + /** + * {@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 CatalogListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CatalogListResult 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 CatalogListResult. + */ + public static CatalogListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CatalogListResult deserializedCatalogListResult = new CatalogListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> CatalogInner.fromJson(reader1)); + deserializedCatalogListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCatalogListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCatalogListResult; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogProperties.java index e176c812f6f3d..725f7f672a6c3 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogProperties.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.sphere.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; /** * Catalog properties. */ @Immutable -public final class CatalogProperties { +public final class CatalogProperties implements JsonSerializable { /* * The Azure Sphere tenant ID associated with the catalog. */ - @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) private String tenantId; /* * The status of the last operation. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -55,4 +57,41 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CatalogProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CatalogProperties 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 CatalogProperties. + */ + public static CatalogProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CatalogProperties deserializedCatalogProperties = new CatalogProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedCatalogProperties.tenantId = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedCatalogProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCatalogProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogUpdate.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogUpdate.java index 63df52959467a..f66b1c7696cd1 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogUpdate.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogUpdate.java @@ -5,20 +5,21 @@ package com.azure.resourcemanager.sphere.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; /** * The type used for update operations of the Catalog. */ @Fluent -public final class CatalogUpdate { +public final class CatalogUpdate implements JsonSerializable { /* * Resource tags. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** @@ -54,4 +55,41 @@ public CatalogUpdate 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 CatalogUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CatalogUpdate 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 CatalogUpdate. + */ + public static CatalogUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CatalogUpdate deserializedCatalogUpdate = new CatalogUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCatalogUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedCatalogUpdate; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateListResult.java index b303342e195e9..ea0be35c6fd85 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateListResult.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateListResult.java @@ -6,25 +6,27 @@ 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.sphere.fluent.models.CertificateInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The response of a Certificate list operation. */ @Fluent -public final class CertificateListResult { +public final class CertificateListResult implements JsonSerializable { /* * The Certificate items on this page */ - @JsonProperty(value = "value", required = true) private List value; /* * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,6 +64,17 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CertificateListResult object itself. + */ + public CertificateListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * @@ -69,12 +82,53 @@ public String nextLink() { */ public void validate() { if (value() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property value in model CertificateListResult")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model CertificateListResult")); } else { value().forEach(e -> e.validate()); } } private static final ClientLogger LOGGER = new ClientLogger(CertificateListResult.class); + + /** + * {@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 CertificateListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CertificateListResult 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 CertificateListResult. + */ + public static CertificateListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CertificateListResult deserializedCertificateListResult = new CertificateListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> CertificateInner.fromJson(reader1)); + deserializedCertificateListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCertificateListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCertificateListResult; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateProperties.java index ff0a7b9f59c4e..72d30e2f96dd4 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateProperties.java @@ -5,54 +5,52 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; /** * The properties of certificate. */ @Immutable -public class CertificateProperties { +public class CertificateProperties implements JsonSerializable { /* * The certificate as a UTF-8 encoded base 64 string. */ - @JsonProperty(value = "certificate", access = JsonProperty.Access.WRITE_ONLY) private String certificate; /* * The certificate status. */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private CertificateStatus status; /* * The certificate subject. */ - @JsonProperty(value = "subject", access = JsonProperty.Access.WRITE_ONLY) private String subject; /* * The certificate thumbprint. */ - @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) private String thumbprint; /* * The certificate expiry date. */ - @JsonProperty(value = "expiryUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime expiryUtc; /* * The certificate not before date. */ - @JsonProperty(value = "notBeforeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime notBeforeUtc; /* * The status of the last operation. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -70,6 +68,17 @@ public String certificate() { return this.certificate; } + /** + * Set the certificate property: The certificate as a UTF-8 encoded base 64 string. + * + * @param certificate the certificate value to set. + * @return the CertificateProperties object itself. + */ + CertificateProperties withCertificate(String certificate) { + this.certificate = certificate; + return this; + } + /** * Get the status property: The certificate status. * @@ -79,6 +88,17 @@ public CertificateStatus status() { return this.status; } + /** + * Set the status property: The certificate status. + * + * @param status the status value to set. + * @return the CertificateProperties object itself. + */ + CertificateProperties withStatus(CertificateStatus status) { + this.status = status; + return this; + } + /** * Get the subject property: The certificate subject. * @@ -88,6 +108,17 @@ public String subject() { return this.subject; } + /** + * Set the subject property: The certificate subject. + * + * @param subject the subject value to set. + * @return the CertificateProperties object itself. + */ + CertificateProperties withSubject(String subject) { + this.subject = subject; + return this; + } + /** * Get the thumbprint property: The certificate thumbprint. * @@ -97,6 +128,17 @@ public String thumbprint() { return this.thumbprint; } + /** + * Set the thumbprint property: The certificate thumbprint. + * + * @param thumbprint the thumbprint value to set. + * @return the CertificateProperties object itself. + */ + CertificateProperties withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + /** * Get the expiryUtc property: The certificate expiry date. * @@ -106,6 +148,17 @@ public OffsetDateTime expiryUtc() { return this.expiryUtc; } + /** + * Set the expiryUtc property: The certificate expiry date. + * + * @param expiryUtc the expiryUtc value to set. + * @return the CertificateProperties object itself. + */ + CertificateProperties withExpiryUtc(OffsetDateTime expiryUtc) { + this.expiryUtc = expiryUtc; + return this; + } + /** * Get the notBeforeUtc property: The certificate not before date. * @@ -115,6 +168,17 @@ public OffsetDateTime notBeforeUtc() { return this.notBeforeUtc; } + /** + * Set the notBeforeUtc property: The certificate not before date. + * + * @param notBeforeUtc the notBeforeUtc value to set. + * @return the CertificateProperties object itself. + */ + CertificateProperties withNotBeforeUtc(OffsetDateTime notBeforeUtc) { + this.notBeforeUtc = notBeforeUtc; + return this; + } + /** * Get the provisioningState property: The status of the last operation. * @@ -124,6 +188,17 @@ public ProvisioningState provisioningState() { return this.provisioningState; } + /** + * Set the provisioningState property: The status of the last operation. + * + * @param provisioningState the provisioningState value to set. + * @return the CertificateProperties object itself. + */ + CertificateProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Validates the instance. * @@ -131,4 +206,54 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CertificateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CertificateProperties 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 CertificateProperties. + */ + public static CertificateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CertificateProperties deserializedCertificateProperties = new CertificateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("certificate".equals(fieldName)) { + deserializedCertificateProperties.certificate = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedCertificateProperties.status = CertificateStatus.fromString(reader.getString()); + } else if ("subject".equals(fieldName)) { + deserializedCertificateProperties.subject = reader.getString(); + } else if ("thumbprint".equals(fieldName)) { + deserializedCertificateProperties.thumbprint = reader.getString(); + } else if ("expiryUtc".equals(fieldName)) { + deserializedCertificateProperties.expiryUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("notBeforeUtc".equals(fieldName)) { + deserializedCertificateProperties.notBeforeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedCertificateProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCertificateProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateStatus.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateStatus.java index 0ef99819e1d63..c128bc9344cb0 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateStatus.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public CertificateStatus() { * @param name a name to look for. * @return the corresponding CertificateStatus. */ - @JsonCreator public static CertificateStatus fromString(String name) { return fromString(name, CertificateStatus.class); } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ClaimDevicesRequest.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ClaimDevicesRequest.java index 12cd6f0eb35df..1ded7f11712f7 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ClaimDevicesRequest.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ClaimDevicesRequest.java @@ -6,18 +6,21 @@ 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; import java.util.List; /** * Request to the action call to bulk claim devices. */ @Fluent -public final class ClaimDevicesRequest { +public final class ClaimDevicesRequest implements JsonSerializable { /* * Device identifiers of the devices to be claimed. */ - @JsonProperty(value = "deviceIdentifiers", required = true) private List deviceIdentifiers; /** @@ -53,10 +56,50 @@ public ClaimDevicesRequest withDeviceIdentifiers(List deviceIdentifiers) */ public void validate() { if (deviceIdentifiers() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property deviceIdentifiers in model ClaimDevicesRequest")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property deviceIdentifiers in model ClaimDevicesRequest")); } } private static final ClientLogger LOGGER = new ClientLogger(ClaimDevicesRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("deviceIdentifiers", this.deviceIdentifiers, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClaimDevicesRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClaimDevicesRequest 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 ClaimDevicesRequest. + */ + public static ClaimDevicesRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClaimDevicesRequest deserializedClaimDevicesRequest = new ClaimDevicesRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceIdentifiers".equals(fieldName)) { + List deviceIdentifiers = reader.readArray(reader1 -> reader1.getString()); + deserializedClaimDevicesRequest.deviceIdentifiers = deviceIdentifiers; + } else { + reader.skipChildren(); + } + } + + return deserializedClaimDevicesRequest; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountDeviceResponse.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountDeviceResponse.java index ab6470e8b571b..e73232bb77916 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountDeviceResponse.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountDeviceResponse.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.sphere.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; /** * Response to the action call for count devices in a catalog (preview API). @@ -33,6 +37,42 @@ public CountDeviceResponse withValue(int value) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("value", value()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CountDeviceResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CountDeviceResponse 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 CountDeviceResponse. + */ + public static CountDeviceResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CountDeviceResponse deserializedCountDeviceResponse = new CountDeviceResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedCountDeviceResponse.withValue(reader.getInt()); + } else { + reader.skipChildren(); + } + } + + return deserializedCountDeviceResponse; + }); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountElementsResponse.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountElementsResponse.java index 1c4ca678f5fe2..e6914fe31cd04 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountElementsResponse.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountElementsResponse.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.sphere.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; /** * Response of the count for elements. */ @Fluent -public class CountElementsResponse { +public class CountElementsResponse implements JsonSerializable { /* * Number of children resources in parent resource. */ - @JsonProperty(value = "value", required = true) private int value; /** @@ -51,4 +54,41 @@ public CountElementsResponse withValue(int value) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CountElementsResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CountElementsResponse 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 CountElementsResponse. + */ + public static CountElementsResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CountElementsResponse deserializedCountElementsResponse = new CountElementsResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedCountElementsResponse.value = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedCountElementsResponse; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployment.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployment.java index 50a4bb9c4ac16..154673183e971 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployment.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployment.java @@ -140,7 +140,7 @@ interface WithProperties { /** * The template for Deployment update. */ - interface Update { + interface Update extends UpdateStages.WithProperties { /** * Executes the update request. * @@ -161,6 +161,18 @@ interface Update { * The Deployment update stages. */ interface UpdateStages { + /** + * The stage of the Deployment update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(DeploymentProperties properties); + } } /** diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentListResult.java index d35e323cdcf60..3a8571e601912 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentListResult.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentListResult.java @@ -6,25 +6,27 @@ 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.sphere.fluent.models.DeploymentInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The response of a Deployment list operation. */ @Fluent -public final class DeploymentListResult { +public final class DeploymentListResult implements JsonSerializable { /* * The Deployment items on this page */ - @JsonProperty(value = "value", required = true) private List value; /* * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,6 +64,17 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the DeploymentListResult object itself. + */ + public DeploymentListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * @@ -69,12 +82,53 @@ public String nextLink() { */ public void validate() { if (value() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property value in model DeploymentListResult")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model DeploymentListResult")); } else { value().forEach(e -> e.validate()); } } private static final ClientLogger LOGGER = new ClientLogger(DeploymentListResult.class); + + /** + * {@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 DeploymentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeploymentListResult 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 DeploymentListResult. + */ + public static DeploymentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeploymentListResult deserializedDeploymentListResult = new DeploymentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> DeploymentInner.fromJson(reader1)); + deserializedDeploymentListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDeploymentListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeploymentListResult; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentProperties.java index 301897ce51c8e..b62cd7da70cdb 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentProperties.java @@ -5,8 +5,13 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.sphere.fluent.models.ImageInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -14,29 +19,25 @@ * The properties of deployment. */ @Fluent -public final class DeploymentProperties { +public final class DeploymentProperties implements JsonSerializable { /* * Deployment ID */ - @JsonProperty(value = "deploymentId") private String deploymentId; /* * Images deployed */ - @JsonProperty(value = "deployedImages") private List deployedImages; /* * Deployment date UTC */ - @JsonProperty(value = "deploymentDateUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime deploymentDateUtc; /* * The status of the last operation. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -113,4 +114,51 @@ public void validate() { deployedImages().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deploymentId", this.deploymentId); + jsonWriter.writeArrayField("deployedImages", this.deployedImages, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeploymentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeploymentProperties 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 DeploymentProperties. + */ + public static DeploymentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeploymentProperties deserializedDeploymentProperties = new DeploymentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deploymentId".equals(fieldName)) { + deserializedDeploymentProperties.deploymentId = reader.getString(); + } else if ("deployedImages".equals(fieldName)) { + List deployedImages = reader.readArray(reader1 -> ImageInner.fromJson(reader1)); + deserializedDeploymentProperties.deployedImages = deployedImages; + } else if ("deploymentDateUtc".equals(fieldName)) { + deserializedDeploymentProperties.deploymentDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedDeploymentProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDeploymentProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupListResult.java index c84c197fd3755..ed16acfc15632 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupListResult.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupListResult.java @@ -6,25 +6,27 @@ 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.sphere.fluent.models.DeviceGroupInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The response of a DeviceGroup list operation. */ @Fluent -public final class DeviceGroupListResult { +public final class DeviceGroupListResult implements JsonSerializable { /* * The DeviceGroup items on this page */ - @JsonProperty(value = "value", required = true) private List value; /* * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,6 +64,17 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the DeviceGroupListResult object itself. + */ + public DeviceGroupListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * @@ -69,12 +82,53 @@ public String nextLink() { */ public void validate() { if (value() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property value in model DeviceGroupListResult")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model DeviceGroupListResult")); } else { value().forEach(e -> e.validate()); } } private static final ClientLogger LOGGER = new ClientLogger(DeviceGroupListResult.class); + + /** + * {@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 DeviceGroupListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceGroupListResult 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 DeviceGroupListResult. + */ + public static DeviceGroupListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceGroupListResult deserializedDeviceGroupListResult = new DeviceGroupListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> DeviceGroupInner.fromJson(reader1)); + deserializedDeviceGroupListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDeviceGroupListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceGroupListResult; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupProperties.java index 007e5cbf4de8e..fb0f97ab06290 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupProperties.java @@ -5,53 +5,50 @@ package com.azure.resourcemanager.sphere.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 properties of deviceGroup. */ @Fluent -public final class DeviceGroupProperties { +public final class DeviceGroupProperties implements JsonSerializable { /* * Description of the device group. */ - @JsonProperty(value = "description") private String description; /* * Operating system feed type of the device group. */ - @JsonProperty(value = "osFeedType") private OSFeedType osFeedType; /* * Update policy of the device group. */ - @JsonProperty(value = "updatePolicy") private UpdatePolicy updatePolicy; /* * Flag to define if the user allows for crash dump collection. */ - @JsonProperty(value = "allowCrashDumpsCollection") private AllowCrashDumpCollection allowCrashDumpsCollection; /* * Regional data boundary for the device group. */ - @JsonProperty(value = "regionalDataBoundary") private RegionalDataBoundary regionalDataBoundary; /* * Deployment status for the device group. */ - @JsonProperty(value = "hasDeployment", access = JsonProperty.Access.WRITE_ONLY) private Boolean hasDeployment; /* * The status of the last operation. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -185,4 +182,61 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("osFeedType", this.osFeedType == null ? null : this.osFeedType.toString()); + jsonWriter.writeStringField("updatePolicy", this.updatePolicy == null ? null : this.updatePolicy.toString()); + jsonWriter.writeStringField("allowCrashDumpsCollection", + this.allowCrashDumpsCollection == null ? null : this.allowCrashDumpsCollection.toString()); + jsonWriter.writeStringField("regionalDataBoundary", + this.regionalDataBoundary == null ? null : this.regionalDataBoundary.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceGroupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceGroupProperties 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 DeviceGroupProperties. + */ + public static DeviceGroupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceGroupProperties deserializedDeviceGroupProperties = new DeviceGroupProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDeviceGroupProperties.description = reader.getString(); + } else if ("osFeedType".equals(fieldName)) { + deserializedDeviceGroupProperties.osFeedType = OSFeedType.fromString(reader.getString()); + } else if ("updatePolicy".equals(fieldName)) { + deserializedDeviceGroupProperties.updatePolicy = UpdatePolicy.fromString(reader.getString()); + } else if ("allowCrashDumpsCollection".equals(fieldName)) { + deserializedDeviceGroupProperties.allowCrashDumpsCollection + = AllowCrashDumpCollection.fromString(reader.getString()); + } else if ("regionalDataBoundary".equals(fieldName)) { + deserializedDeviceGroupProperties.regionalDataBoundary + = RegionalDataBoundary.fromString(reader.getString()); + } else if ("hasDeployment".equals(fieldName)) { + deserializedDeviceGroupProperties.hasDeployment = reader.getNullable(JsonReader::getBoolean); + } else if ("provisioningState".equals(fieldName)) { + deserializedDeviceGroupProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceGroupProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdate.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdate.java index 6b8a3dedd1714..9e9762802a5e5 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdate.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdate.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.sphere.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 type used for update operations of the DeviceGroup. */ @Fluent -public final class DeviceGroupUpdate { +public final class DeviceGroupUpdate implements JsonSerializable { /* * The updatable properties of the DeviceGroup. */ - @JsonProperty(value = "properties") private DeviceGroupUpdateProperties properties; /** @@ -54,4 +57,40 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceGroupUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceGroupUpdate 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 DeviceGroupUpdate. + */ + public static DeviceGroupUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceGroupUpdate deserializedDeviceGroupUpdate = new DeviceGroupUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedDeviceGroupUpdate.properties = DeviceGroupUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceGroupUpdate; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdateProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdateProperties.java index 0761b1534557d..fd179cb5cea01 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdateProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdateProperties.java @@ -5,41 +5,40 @@ package com.azure.resourcemanager.sphere.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 updatable properties of the DeviceGroup. */ @Fluent -public final class DeviceGroupUpdateProperties { +public final class DeviceGroupUpdateProperties implements JsonSerializable { /* * Description of the device group. */ - @JsonProperty(value = "description") private String description; /* * Operating system feed type of the device group. */ - @JsonProperty(value = "osFeedType") private OSFeedType osFeedType; /* * Update policy of the device group. */ - @JsonProperty(value = "updatePolicy") private UpdatePolicy updatePolicy; /* * Flag to define if the user allows for crash dump collection. */ - @JsonProperty(value = "allowCrashDumpsCollection") private AllowCrashDumpCollection allowCrashDumpsCollection; /* * Regional data boundary for the device group. */ - @JsonProperty(value = "regionalDataBoundary") private RegionalDataBoundary regionalDataBoundary; /** @@ -156,4 +155,56 @@ public DeviceGroupUpdateProperties withRegionalDataBoundary(RegionalDataBoundary */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("osFeedType", this.osFeedType == null ? null : this.osFeedType.toString()); + jsonWriter.writeStringField("updatePolicy", this.updatePolicy == null ? null : this.updatePolicy.toString()); + jsonWriter.writeStringField("allowCrashDumpsCollection", + this.allowCrashDumpsCollection == null ? null : this.allowCrashDumpsCollection.toString()); + jsonWriter.writeStringField("regionalDataBoundary", + this.regionalDataBoundary == null ? null : this.regionalDataBoundary.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceGroupUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceGroupUpdateProperties 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 DeviceGroupUpdateProperties. + */ + public static DeviceGroupUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceGroupUpdateProperties deserializedDeviceGroupUpdateProperties = new DeviceGroupUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDeviceGroupUpdateProperties.description = reader.getString(); + } else if ("osFeedType".equals(fieldName)) { + deserializedDeviceGroupUpdateProperties.osFeedType = OSFeedType.fromString(reader.getString()); + } else if ("updatePolicy".equals(fieldName)) { + deserializedDeviceGroupUpdateProperties.updatePolicy = UpdatePolicy.fromString(reader.getString()); + } else if ("allowCrashDumpsCollection".equals(fieldName)) { + deserializedDeviceGroupUpdateProperties.allowCrashDumpsCollection + = AllowCrashDumpCollection.fromString(reader.getString()); + } else if ("regionalDataBoundary".equals(fieldName)) { + deserializedDeviceGroupUpdateProperties.regionalDataBoundary + = RegionalDataBoundary.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceGroupUpdateProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceListResult.java index 731fcd4e2491c..762197a61e8e5 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceListResult.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceListResult.java @@ -6,25 +6,27 @@ 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.sphere.fluent.models.DeviceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The response of a Device list operation. */ @Fluent -public final class DeviceListResult { +public final class DeviceListResult implements JsonSerializable { /* * The Device items on this page */ - @JsonProperty(value = "value", required = true) private List value; /* * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,6 +64,17 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the DeviceListResult object itself. + */ + public DeviceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * @@ -69,12 +82,53 @@ public String nextLink() { */ public void validate() { if (value() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property value in model DeviceListResult")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model DeviceListResult")); } else { value().forEach(e -> e.validate()); } } private static final ClientLogger LOGGER = new ClientLogger(DeviceListResult.class); + + /** + * {@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 DeviceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceListResult 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 DeviceListResult. + */ + public static DeviceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceListResult deserializedDeviceListResult = new DeviceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> DeviceInner.fromJson(reader1)); + deserializedDeviceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDeviceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceListResult; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceProperties.java index 0367cccef4a0a..646ce4adc9833 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceProperties.java @@ -5,54 +5,52 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; /** * The properties of device. */ @Fluent -public final class DeviceProperties { +public final class DeviceProperties implements JsonSerializable { /* * Device ID */ - @JsonProperty(value = "deviceId") private String deviceId; /* * SKU of the chip */ - @JsonProperty(value = "chipSku", access = JsonProperty.Access.WRITE_ONLY) private String chipSku; /* * OS version available for installation when update requested */ - @JsonProperty(value = "lastAvailableOsVersion", access = JsonProperty.Access.WRITE_ONLY) private String lastAvailableOsVersion; /* * OS version running on device when update requested */ - @JsonProperty(value = "lastInstalledOsVersion", access = JsonProperty.Access.WRITE_ONLY) private String lastInstalledOsVersion; /* * Time when update requested and new OS version available */ - @JsonProperty(value = "lastOsUpdateUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastOsUpdateUtc; /* * Time when update was last requested */ - @JsonProperty(value = "lastUpdateRequestUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastUpdateRequestUtc; /* * The status of the last operation. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -142,4 +140,54 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deviceId", this.deviceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceProperties 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 DeviceProperties. + */ + public static DeviceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceProperties deserializedDeviceProperties = new DeviceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceId".equals(fieldName)) { + deserializedDeviceProperties.deviceId = reader.getString(); + } else if ("chipSku".equals(fieldName)) { + deserializedDeviceProperties.chipSku = reader.getString(); + } else if ("lastAvailableOsVersion".equals(fieldName)) { + deserializedDeviceProperties.lastAvailableOsVersion = reader.getString(); + } else if ("lastInstalledOsVersion".equals(fieldName)) { + deserializedDeviceProperties.lastInstalledOsVersion = reader.getString(); + } else if ("lastOsUpdateUtc".equals(fieldName)) { + deserializedDeviceProperties.lastOsUpdateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastUpdateRequestUtc".equals(fieldName)) { + deserializedDeviceProperties.lastUpdateRequestUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedDeviceProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdate.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdate.java index 513a2533d53e6..dbc73c4c71452 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdate.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdate.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.sphere.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 type used for update operations of the Device. */ @Fluent -public final class DeviceUpdate { +public final class DeviceUpdate implements JsonSerializable { /* * The updatable properties of the Device. */ - @JsonProperty(value = "properties") private DeviceUpdateProperties properties; /** @@ -54,4 +57,40 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceUpdate 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 DeviceUpdate. + */ + public static DeviceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceUpdate deserializedDeviceUpdate = new DeviceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedDeviceUpdate.properties = DeviceUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceUpdate; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdateProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdateProperties.java index 9b6696d7d517d..ed61cae1c8423 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdateProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdateProperties.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.sphere.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 updatable properties of the Device. */ @Fluent -public final class DeviceUpdateProperties { +public final class DeviceUpdateProperties implements JsonSerializable { /* * Device group id */ - @JsonProperty(value = "deviceGroupId") private String deviceGroupId; /** @@ -51,4 +54,40 @@ public DeviceUpdateProperties withDeviceGroupId(String deviceGroupId) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deviceGroupId", this.deviceGroupId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceUpdateProperties 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 DeviceUpdateProperties. + */ + public static DeviceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceUpdateProperties deserializedDeviceUpdateProperties = new DeviceUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceGroupId".equals(fieldName)) { + deserializedDeviceUpdateProperties.deviceGroupId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceUpdateProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/GenerateCapabilityImageRequest.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/GenerateCapabilityImageRequest.java index 149670e052b4d..6cf526f2835bb 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/GenerateCapabilityImageRequest.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/GenerateCapabilityImageRequest.java @@ -6,18 +6,21 @@ 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; import java.util.List; /** * Request of the action to create a signed device capability image. */ @Fluent -public final class GenerateCapabilityImageRequest { +public final class GenerateCapabilityImageRequest implements JsonSerializable { /* * List of capabilities to create */ - @JsonProperty(value = "capabilities", required = true) private List capabilities; /** @@ -53,10 +56,52 @@ public GenerateCapabilityImageRequest withCapabilities(List capa */ public void validate() { if (capabilities() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property capabilities in model GenerateCapabilityImageRequest")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property capabilities in model GenerateCapabilityImageRequest")); } } private static final ClientLogger LOGGER = new ClientLogger(GenerateCapabilityImageRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("capabilities", this.capabilities, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenerateCapabilityImageRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenerateCapabilityImageRequest 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 GenerateCapabilityImageRequest. + */ + public static GenerateCapabilityImageRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GenerateCapabilityImageRequest deserializedGenerateCapabilityImageRequest + = new GenerateCapabilityImageRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("capabilities".equals(fieldName)) { + List capabilities + = reader.readArray(reader1 -> CapabilityType.fromString(reader1.getString())); + deserializedGenerateCapabilityImageRequest.capabilities = capabilities; + } else { + reader.skipChildren(); + } + } + + return deserializedGenerateCapabilityImageRequest; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Image.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Image.java index c9834ae799a37..8db4189339e11 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Image.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Image.java @@ -137,7 +137,7 @@ interface WithProperties { /** * The template for Image update. */ - interface Update { + interface Update extends UpdateStages.WithProperties { /** * Executes the update request. * @@ -158,6 +158,18 @@ interface Update { * The Image update stages. */ interface UpdateStages { + /** + * The stage of the Image update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ImageProperties properties); + } } /** diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageListResult.java index a88e846764dcd..e5d85c33cc350 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageListResult.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageListResult.java @@ -6,25 +6,27 @@ 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.sphere.fluent.models.ImageInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The response of a Image list operation. */ @Fluent -public final class ImageListResult { +public final class ImageListResult implements JsonSerializable { /* * The Image items on this page */ - @JsonProperty(value = "value", required = true) private List value; /* * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,6 +64,17 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ImageListResult object itself. + */ + public ImageListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * @@ -69,12 +82,53 @@ public String nextLink() { */ public void validate() { if (value() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property value in model ImageListResult")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ImageListResult")); } else { value().forEach(e -> e.validate()); } } private static final ClientLogger LOGGER = new ClientLogger(ImageListResult.class); + + /** + * {@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 ImageListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImageListResult 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 ImageListResult. + */ + public static ImageListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImageListResult deserializedImageListResult = new ImageListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ImageInner.fromJson(reader1)); + deserializedImageListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedImageListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedImageListResult; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageProperties.java index a2c63b632aa81..ac015fc799684 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageProperties.java @@ -5,65 +5,60 @@ package com.azure.resourcemanager.sphere.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 properties of image. */ @Fluent -public final class ImageProperties { +public final class ImageProperties implements JsonSerializable { /* * Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads. */ - @JsonProperty(value = "image") private String image; /* * Image ID */ - @JsonProperty(value = "imageId") private String imageId; /* * Image name */ - @JsonProperty(value = "imageName", access = JsonProperty.Access.WRITE_ONLY) private String imageName; /* * Regional data boundary for an image */ - @JsonProperty(value = "regionalDataBoundary") private RegionalDataBoundary regionalDataBoundary; /* * Location the image */ - @JsonProperty(value = "uri", access = JsonProperty.Access.WRITE_ONLY) private String uri; /* * The image description. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * The image component id. */ - @JsonProperty(value = "componentId", access = JsonProperty.Access.WRITE_ONLY) private String componentId; /* * The image type. */ - @JsonProperty(value = "imageType", access = JsonProperty.Access.WRITE_ONLY) private ImageType imageType; /* * The status of the last operation. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -195,4 +190,60 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("image", this.image); + jsonWriter.writeStringField("imageId", this.imageId); + jsonWriter.writeStringField("regionalDataBoundary", + this.regionalDataBoundary == null ? null : this.regionalDataBoundary.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImageProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImageProperties 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 ImageProperties. + */ + public static ImageProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImageProperties deserializedImageProperties = new ImageProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("image".equals(fieldName)) { + deserializedImageProperties.image = reader.getString(); + } else if ("imageId".equals(fieldName)) { + deserializedImageProperties.imageId = reader.getString(); + } else if ("imageName".equals(fieldName)) { + deserializedImageProperties.imageName = reader.getString(); + } else if ("regionalDataBoundary".equals(fieldName)) { + deserializedImageProperties.regionalDataBoundary + = RegionalDataBoundary.fromString(reader.getString()); + } else if ("uri".equals(fieldName)) { + deserializedImageProperties.uri = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedImageProperties.description = reader.getString(); + } else if ("componentId".equals(fieldName)) { + deserializedImageProperties.componentId = reader.getString(); + } else if ("imageType".equals(fieldName)) { + deserializedImageProperties.imageType = ImageType.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedImageProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedImageProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageType.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageType.java index 6d4989951a21e..5394d881b93ba 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageType.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -147,7 +146,6 @@ public ImageType() { * @param name a name to look for. * @return the corresponding ImageType. */ - @JsonCreator public static ImageType fromString(String name) { return fromString(name, ImageType.class); } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ListDeviceGroupsRequest.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ListDeviceGroupsRequest.java index 577a0d17c6feb..223b17b015bbc 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ListDeviceGroupsRequest.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ListDeviceGroupsRequest.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.sphere.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; /** * Request of the action to list device groups for a catalog. */ @Fluent -public final class ListDeviceGroupsRequest { +public final class ListDeviceGroupsRequest implements JsonSerializable { /* * Device Group name. */ - @JsonProperty(value = "deviceGroupName") private String deviceGroupName; /** @@ -51,4 +54,40 @@ public ListDeviceGroupsRequest withDeviceGroupName(String deviceGroupName) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deviceGroupName", this.deviceGroupName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListDeviceGroupsRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListDeviceGroupsRequest 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 ListDeviceGroupsRequest. + */ + public static ListDeviceGroupsRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListDeviceGroupsRequest deserializedListDeviceGroupsRequest = new ListDeviceGroupsRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceGroupName".equals(fieldName)) { + deserializedListDeviceGroupsRequest.deviceGroupName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedListDeviceGroupsRequest; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OSFeedType.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OSFeedType.java index df86906705bf7..1f90b19796366 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OSFeedType.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OSFeedType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public OSFeedType() { * @param name a name to look for. * @return the corresponding OSFeedType. */ - @JsonCreator public static OSFeedType fromString(String name) { return fromString(name, OSFeedType.class); } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationDisplay.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationDisplay.java index 176049cf9e0d7..8855b96adada0 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationDisplay.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationDisplay.java @@ -5,38 +5,38 @@ package com.azure.resourcemanager.sphere.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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationListResult.java index 01821c5564be6..2c28d34fb2ca3 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationListResult.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationListResult.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.sphere.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.sphere.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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Origin.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Origin.java index 7b023584191ff..f2e8466fe9be0 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Origin.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Origin.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/PagedDeviceInsight.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/PagedDeviceInsight.java index 518bec40d5447..77c8ba0cc0eb3 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/PagedDeviceInsight.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/PagedDeviceInsight.java @@ -6,25 +6,27 @@ 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.sphere.fluent.models.DeviceInsightInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Paged collection of DeviceInsight items. */ @Fluent -public final class PagedDeviceInsight { +public final class PagedDeviceInsight implements JsonSerializable { /* * The DeviceInsight items on this page */ - @JsonProperty(value = "value", required = true) private List value; /* * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,6 +64,17 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the PagedDeviceInsight object itself. + */ + public PagedDeviceInsight withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * @@ -69,12 +82,53 @@ public String nextLink() { */ public void validate() { if (value() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property value in model PagedDeviceInsight")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model PagedDeviceInsight")); } else { value().forEach(e -> e.validate()); } } private static final ClientLogger LOGGER = new ClientLogger(PagedDeviceInsight.class); + + /** + * {@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 PagedDeviceInsight from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PagedDeviceInsight 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 PagedDeviceInsight. + */ + public static PagedDeviceInsight fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PagedDeviceInsight deserializedPagedDeviceInsight = new PagedDeviceInsight(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> DeviceInsightInner.fromJson(reader1)); + deserializedPagedDeviceInsight.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPagedDeviceInsight.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPagedDeviceInsight; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductListResult.java index 1008e53514ebe..7287b239311e7 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductListResult.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductListResult.java @@ -6,25 +6,27 @@ 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.sphere.fluent.models.ProductInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The response of a Product list operation. */ @Fluent -public final class ProductListResult { +public final class ProductListResult implements JsonSerializable { /* * The Product items on this page */ - @JsonProperty(value = "value", required = true) private List value; /* * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,6 +64,17 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ProductListResult object itself. + */ + public ProductListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * @@ -69,12 +82,53 @@ public String nextLink() { */ public void validate() { if (value() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property value in model ProductListResult")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ProductListResult")); } else { value().forEach(e -> e.validate()); } } private static final ClientLogger LOGGER = new ClientLogger(ProductListResult.class); + + /** + * {@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 ProductListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductListResult 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 ProductListResult. + */ + public static ProductListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductListResult deserializedProductListResult = new ProductListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ProductInner.fromJson(reader1)); + deserializedProductListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedProductListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProductListResult; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductProperties.java index 477c971fdda9e..680ba11610a29 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductProperties.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.sphere.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 properties of product. */ @Fluent -public final class ProductProperties { +public final class ProductProperties implements JsonSerializable { /* * Description of the product */ - @JsonProperty(value = "description") private String description; /* * The status of the last operation. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -66,4 +68,42 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductProperties 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 ProductProperties. + */ + public static ProductProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductProperties deserializedProductProperties = new ProductProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedProductProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedProductProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedProductProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdate.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdate.java index 344d810850829..f1514c5d00beb 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdate.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdate.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.sphere.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 type used for update operations of the Product. */ @Fluent -public final class ProductUpdate { +public final class ProductUpdate implements JsonSerializable { /* * The updatable properties of the Product. */ - @JsonProperty(value = "properties") private ProductUpdateProperties properties; /** @@ -54,4 +57,40 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductUpdate 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 ProductUpdate. + */ + public static ProductUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductUpdate deserializedProductUpdate = new ProductUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedProductUpdate.properties = ProductUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProductUpdate; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdateProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdateProperties.java index fd4cc19da2ffe..a174510994169 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdateProperties.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdateProperties.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.sphere.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 updatable properties of the Product. */ @Fluent -public final class ProductUpdateProperties { +public final class ProductUpdateProperties implements JsonSerializable { /* * Description of the product */ - @JsonProperty(value = "description") private String description; /** @@ -51,4 +54,40 @@ public ProductUpdateProperties withDescription(String description) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductUpdateProperties 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 ProductUpdateProperties. + */ + public static ProductUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductUpdateProperties deserializedProductUpdateProperties = new ProductUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedProductUpdateProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProductUpdateProperties; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceRequest.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceRequest.java index 04c79b6216470..0f950c7222415 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceRequest.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceRequest.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; /** * Request for the proof of possession nonce. */ @Fluent -public final class ProofOfPossessionNonceRequest { +public final class ProofOfPossessionNonceRequest implements JsonSerializable { /* * The proof of possession nonce */ - @JsonProperty(value = "proofOfPossessionNonce", required = true) private String proofOfPossessionNonce; /** @@ -52,10 +55,49 @@ public ProofOfPossessionNonceRequest withProofOfPossessionNonce(String proofOfPo */ public void validate() { if (proofOfPossessionNonce() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property proofOfPossessionNonce in model ProofOfPossessionNonceRequest")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property proofOfPossessionNonce in model ProofOfPossessionNonceRequest")); } } private static final ClientLogger LOGGER = new ClientLogger(ProofOfPossessionNonceRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("proofOfPossessionNonce", this.proofOfPossessionNonce); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProofOfPossessionNonceRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProofOfPossessionNonceRequest 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 ProofOfPossessionNonceRequest. + */ + public static ProofOfPossessionNonceRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProofOfPossessionNonceRequest deserializedProofOfPossessionNonceRequest + = new ProofOfPossessionNonceRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("proofOfPossessionNonce".equals(fieldName)) { + deserializedProofOfPossessionNonceRequest.proofOfPossessionNonce = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProofOfPossessionNonceRequest; + }); + } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProvisioningState.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProvisioningState.java index 83fe4afb8936e..2a6b59e7fcdda 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProvisioningState.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -62,7 +61,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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/RegionalDataBoundary.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/RegionalDataBoundary.java index d91169299d5fc..a95797549724c 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/RegionalDataBoundary.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/RegionalDataBoundary.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public RegionalDataBoundary() { * @param name a name to look for. * @return the corresponding RegionalDataBoundary. */ - @JsonCreator public static RegionalDataBoundary fromString(String name) { return fromString(name, RegionalDataBoundary.class); } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/UpdatePolicy.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/UpdatePolicy.java index dfcee7e165628..6ee016843ca6a 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/UpdatePolicy.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/UpdatePolicy.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.sphere.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public UpdatePolicy() { * @param name a name to look for. * @return the corresponding UpdatePolicy. */ - @JsonCreator public static UpdatePolicy fromString(String name) { return fromString(name, UpdatePolicy.class); } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/module-info.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/module-info.java index 43174b86146e3..bded277fe62ef 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/module-info.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/module-info.java @@ -10,6 +10,6 @@ exports com.azure.resourcemanager.sphere.fluent.models; exports com.azure.resourcemanager.sphere.models; - opens com.azure.resourcemanager.sphere.fluent.models to com.azure.core, com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.sphere.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.sphere.fluent.models to com.azure.core; + opens com.azure.resourcemanager.sphere.models to com.azure.core; } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-sphere/proxy-config.json b/sdk/sphere/azure-resourcemanager-sphere/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-sphere/proxy-config.json index 059551aba04b7..6b03c9c1ad97c 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-sphere/proxy-config.json +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-sphere/proxy-config.json @@ -1 +1 @@ -[ [ "com.azure.resourcemanager.sphere.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.sphere.implementation.CatalogsClientImpl$CatalogsService" ], [ "com.azure.resourcemanager.sphere.implementation.CertificatesClientImpl$CertificatesService" ], [ "com.azure.resourcemanager.sphere.implementation.ImagesClientImpl$ImagesService" ], [ "com.azure.resourcemanager.sphere.implementation.ProductsClientImpl$ProductsService" ], [ "com.azure.resourcemanager.sphere.implementation.DeviceGroupsClientImpl$DeviceGroupsService" ], [ "com.azure.resourcemanager.sphere.implementation.DeploymentsClientImpl$DeploymentsService" ], [ "com.azure.resourcemanager.sphere.implementation.DevicesClientImpl$DevicesService" ] ] \ No newline at end of file +[["com.azure.resourcemanager.sphere.implementation.CatalogsClientImpl$CatalogsService"],["com.azure.resourcemanager.sphere.implementation.CertificatesClientImpl$CertificatesService"],["com.azure.resourcemanager.sphere.implementation.DeploymentsClientImpl$DeploymentsService"],["com.azure.resourcemanager.sphere.implementation.DeviceGroupsClientImpl$DeviceGroupsService"],["com.azure.resourcemanager.sphere.implementation.DevicesClientImpl$DevicesService"],["com.azure.resourcemanager.sphere.implementation.ImagesClientImpl$ImagesService"],["com.azure.resourcemanager.sphere.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.sphere.implementation.ProductsClientImpl$ProductsService"]] \ No newline at end of file diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-sphere/reflect-config.json b/sdk/sphere/azure-resourcemanager-sphere/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-sphere/reflect-config.json index 9bba8e24f5a1f..0637a088a01e8 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-sphere/reflect-config.json +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-sphere/reflect-config.json @@ -1,266 +1 @@ -[ { - "name" : "com.azure.resourcemanager.sphere.models.OperationListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.OperationInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.OperationDisplay", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.CatalogListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.CatalogInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.CatalogProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.CatalogUpdate", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.CertificateListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.CertificateInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.CertificateProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.CertificateChainResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.ProofOfPossessionNonceResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.CountDevicesResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.CountElementsResponse", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ImageListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.ImageInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ImageProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeploymentListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.DeploymentInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeploymentProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ListDeviceGroupsRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeviceGroupListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeviceGroupProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.PagedDeviceInsight", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.DeviceInsightInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeviceListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.DeviceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeviceProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ProductListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.ProductInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ProductProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ProductUpdate", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ProductUpdateProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeviceGroupUpdate", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeviceGroupUpdateProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ClaimDevicesRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeviceUpdate", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.DeviceUpdateProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.GenerateCapabilityImageRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.fluent.models.SignedCapabilityImageResponseInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.CountDeviceResponse", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.Origin", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ActionType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ProvisioningState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.CertificateStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.RegionalDataBoundary", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.ImageType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.OSFeedType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.UpdatePolicy", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.sphere.models.CapabilityType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -} ] \ No newline at end of file +[] \ No newline at end of file diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateSamples.java index 5a3cc146ac6e0..b92c09270a230 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateSamples.java @@ -18,7 +18,10 @@ public final class CatalogsCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().define("MyCatalog1").withRegion("global").withExistingResourceGroup("MyResourceGroup1") + manager.catalogs() + .define("MyCatalog1") + .withRegion("global") + .withExistingResourceGroup("MyResourceGroup1") .create(); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupSamples.java index 0420cbde35826..2cccdcc18627c 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupSamples.java @@ -18,7 +18,7 @@ public final class CatalogsGetByResourceGroupSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().getByResourceGroupWithResponse("MyResourceGroup1", "MyCatalog1", - com.azure.core.util.Context.NONE); + manager.catalogs() + .getByResourceGroupWithResponse("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsSamples.java index 7acbb393e10d4..ba22dc4d53847 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsSamples.java @@ -18,7 +18,8 @@ public final class CatalogsListDeploymentsSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsListDeployments(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().listDeployments("MyResourceGroup1", "MyCatalog1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.catalogs() + .listDeployments("MyResourceGroup1", "MyCatalog1", null, null, null, null, + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsSamples.java index f15657f10a594..e6ed6ad3be967 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsSamples.java @@ -20,8 +20,9 @@ public final class CatalogsListDeviceGroupsSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsListDeviceGroups(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().listDeviceGroups("MyResourceGroup1", "MyCatalog1", - new ListDeviceGroupsRequest().withDeviceGroupName("MyDeviceGroup1"), null, null, null, null, - com.azure.core.util.Context.NONE); + manager.catalogs() + .listDeviceGroups("MyResourceGroup1", "MyCatalog1", + new ListDeviceGroupsRequest().withDeviceGroupName("MyDeviceGroup1"), null, null, null, null, + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsSamples.java index ef493a48a9053..72a6f96bd8763 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsSamples.java @@ -18,7 +18,8 @@ public final class CatalogsListDeviceInsightsSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsListDeviceInsights(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().listDeviceInsights("MyResourceGroup1", "MyCatalog1", null, 10, null, null, - com.azure.core.util.Context.NONE); + manager.catalogs() + .listDeviceInsights("MyResourceGroup1", "MyCatalog1", null, 10, null, null, + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesSamples.java index ba19e546a2b54..4a84d8604a29e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesSamples.java @@ -19,7 +19,7 @@ public final class CatalogsListDevicesSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsListDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().listDevices("MyResourceGroup1", "MyCatalog1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.catalogs() + .listDevices("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsUploadImageSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsUploadImageSamples.java index dcc15f12a1375..ed56408e6bb3f 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsUploadImageSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsUploadImageSamples.java @@ -22,8 +22,9 @@ public final class CatalogsUploadImageSamples { * @param manager Entry point to AzureSphereManager. */ public static void catalogsUploadImage(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.catalogs().uploadImage("MyResourceGroup1", "MyCatalog1", - new ImageInner().withProperties(new ImageProperties().withImage("bXliYXNlNjRzdHJpbmc=")), - com.azure.core.util.Context.NONE); + manager.catalogs() + .uploadImage("MyResourceGroup1", "MyCatalog1", + new ImageInner().withProperties(new ImageProperties().withImage("bXliYXNlNjRzdHJpbmc=")), + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesGetSamples.java index 8a7d5fc255e37..5d1f3d779f12e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesGetSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesGetSamples.java @@ -18,7 +18,7 @@ public final class CertificatesGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void certificatesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.certificates().getWithResponse("MyResourceGroup1", "MyCatalog1", "default", - com.azure.core.util.Context.NONE); + manager.certificates() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "default", com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogSamples.java index 3d33950347e85..56a1019b02d4f 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogSamples.java @@ -18,7 +18,7 @@ public final class CertificatesListByCatalogSamples { * @param manager Entry point to AzureSphereManager. */ public static void certificatesListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.certificates().listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.certificates() + .listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainSamples.java index 7fdfb2a053605..b7bc5ec25bff9 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainSamples.java @@ -18,7 +18,8 @@ public final class CertificatesRetrieveCertChainSamples { * @param manager Entry point to AzureSphereManager. */ public static void certificatesRetrieveCertChain(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.certificates().retrieveCertChainWithResponse("MyResourceGroup1", "MyCatalog1", "active", - com.azure.core.util.Context.NONE); + manager.certificates() + .retrieveCertChainWithResponse("MyResourceGroup1", "MyCatalog1", "active", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceSamples.java index f3893547209f9..b55a4beb50c6e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceSamples.java @@ -21,8 +21,9 @@ public final class CertificatesRetrieveProofOfPossessionNonceSamples { */ public static void certificatesRetrieveProofOfPossessionNonce(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.certificates().retrieveProofOfPossessionNonceWithResponse("MyResourceGroup1", "MyCatalog1", "active", - new ProofOfPossessionNonceRequest().withProofOfPossessionNonce("proofOfPossessionNonce"), - com.azure.core.util.Context.NONE); + manager.certificates() + .retrieveProofOfPossessionNonceWithResponse("MyResourceGroup1", "MyCatalog1", "active", + new ProofOfPossessionNonceRequest().withProofOfPossessionNonce("proofOfPossessionNonce"), + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateSamples.java index f88e47e470a64..a5e88b3f9dfb5 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateSamples.java @@ -18,7 +18,9 @@ public final class DeploymentsCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void deploymentsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deployments().define("MyDeployment1") - .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1").create(); + manager.deployments() + .define("MyDeployment1") + .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1") + .create(); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteSamples.java index 72ae93fe3f1df..9d7822a83600d 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteSamples.java @@ -18,7 +18,8 @@ public final class DeploymentsDeleteSamples { * @param manager Entry point to AzureSphereManager. */ public static void deploymentsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deployments().delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", - "MyDeploymentName1", com.azure.core.util.Context.NONE); + manager.deployments() + .delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", "MyDeploymentName1", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetSamples.java index 9179cd7968628..b0f6ab82acfa8 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetSamples.java @@ -18,7 +18,8 @@ public final class DeploymentsGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void deploymentsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deployments().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", - "MyDeployment1", com.azure.core.util.Context.NONE); + manager.deployments() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "MyDeployment1", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupSamples.java index 35084689ffd01..5e52f81fe25b6 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupSamples.java @@ -18,7 +18,8 @@ public final class DeploymentsListByDeviceGroupSamples { * @param manager Entry point to AzureSphereManager. */ public static void deploymentsListByDeviceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deployments().listByDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", null, - null, null, null, com.azure.core.util.Context.NONE); + manager.deployments() + .listByDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", null, null, null, null, + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsClaimDevicesSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsClaimDevicesSamples.java index e41bfdfa6b1e2..780631a9b6219 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsClaimDevicesSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsClaimDevicesSamples.java @@ -21,9 +21,10 @@ public final class DeviceGroupsClaimDevicesSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsClaimDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().claimDevices("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", - new ClaimDevicesRequest().withDeviceIdentifiers(Arrays.asList( - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")), - com.azure.core.util.Context.NONE); + manager.deviceGroups() + .claimDevices("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + new ClaimDevicesRequest().withDeviceIdentifiers(Arrays.asList( + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")), + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesSamples.java index 417723a372ecc..72f59bb118a66 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesSamples.java @@ -18,7 +18,8 @@ public final class DeviceGroupsCountDevicesSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - "MyDeviceGroup1", com.azure.core.util.Context.NONE); + manager.deviceGroups() + .countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateSamples.java index 757c2d3de33a6..339a50c125755 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateSamples.java @@ -22,10 +22,12 @@ public final class DeviceGroupsCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().define("MyDeviceGroup1") + manager.deviceGroups() + .define("MyDeviceGroup1") .withExistingProduct("MyResourceGroup1", "MyCatalog1", "MyProduct1") .withProperties(new DeviceGroupProperties().withDescription("Description for MyDeviceGroup1") - .withOsFeedType(OSFeedType.RETAIL).withUpdatePolicy(UpdatePolicy.UPDATE_ALL)) + .withOsFeedType(OSFeedType.RETAIL) + .withUpdatePolicy(UpdatePolicy.UPDATE_ALL)) .create(); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteSamples.java index 63394eb71fc62..68a1ee70783fb 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteSamples.java @@ -18,7 +18,7 @@ public final class DeviceGroupsDeleteSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().delete("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", - com.azure.core.util.Context.NONE); + manager.deviceGroups() + .delete("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetSamples.java index 2f49c0aeb21dd..2f12dff024b38 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetSamples.java @@ -18,7 +18,8 @@ public final class DeviceGroupsGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", - com.azure.core.util.Context.NONE); + manager.deviceGroups() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductSamples.java index 830df666d347b..c0cdfd264c272 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductSamples.java @@ -18,7 +18,8 @@ public final class DeviceGroupsListByProductSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsListByProduct(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.deviceGroups().listByProduct("MyResourceGroup1", "MyCatalog1", "MyProduct1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.deviceGroups() + .listByProduct("MyResourceGroup1", "MyCatalog1", "MyProduct1", null, null, null, null, + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsUpdateSamples.java index 38228e0b95184..3f572ba2a6dc2 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsUpdateSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsUpdateSamples.java @@ -20,8 +20,10 @@ public final class DeviceGroupsUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void deviceGroupsUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - DeviceGroup resource = manager.deviceGroups().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - "MyDeviceGroup1", com.azure.core.util.Context.NONE).getValue(); + DeviceGroup resource = manager.deviceGroups() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateSamples.java index b549d4b03c751..1ec3bb6cb5ec4 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateSamples.java @@ -18,8 +18,10 @@ public final class DevicesCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().define( - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") - .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1").create(); + manager.devices() + .define( + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") + .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1") + .create(); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteSamples.java index 0f05b19ae8e9d..bbef55ea2e20b 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteSamples.java @@ -18,8 +18,9 @@ public final class DevicesDeleteSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - com.azure.core.util.Context.NONE); + manager.devices() + .delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageSamples.java index c50b6947e56e7..f5a2bf1255cf2 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageSamples.java @@ -22,10 +22,11 @@ public final class DevicesGenerateCapabilityImageSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesGenerateCapabilityImage(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().generateCapabilityImage("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - new GenerateCapabilityImageRequest().withCapabilities( - Arrays.asList(CapabilityType.APPLICATION_DEVELOPMENT)), - com.azure.core.util.Context.NONE); + manager.devices() + .generateCapabilityImage("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + new GenerateCapabilityImageRequest().withCapabilities( + Arrays.asList(CapabilityType.APPLICATION_DEVELOPMENT)), + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGetSamples.java index d1d4264593aa4..775fc01b83c28 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGetSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGetSamples.java @@ -18,8 +18,9 @@ public final class DevicesGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - com.azure.core.util.Context.NONE); + manager.devices() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupSamples.java index 4efea809c5825..de92ff276bf18 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupSamples.java @@ -18,7 +18,8 @@ public final class DevicesListByDeviceGroupSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesListByDeviceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.devices().listByDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", - com.azure.core.util.Context.NONE); + manager.devices() + .listByDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesUpdateSamples.java index a7d30f3514f72..eb97bdd42be28 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesUpdateSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesUpdateSamples.java @@ -20,10 +20,11 @@ public final class DevicesUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void devicesUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - Device resource = manager.devices().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - "MyDeviceGroup1", - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - com.azure.core.util.Context.NONE).getValue(); + Device resource = manager.devices() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateSamples.java index 1637da43bbb6e..1f91098a4c89a 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateSamples.java @@ -20,8 +20,10 @@ public final class ImagesCreateOrUpdateSamples { * @param manager Entry point to AzureSphereManager. */ public static void imageCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.images().define("00000000-0000-0000-0000-000000000000") + manager.images() + .define("00000000-0000-0000-0000-000000000000") .withExistingCatalog("MyResourceGroup1", "MyCatalog1") - .withProperties(new ImageProperties().withImage("bXliYXNlNjRzdHJpbmc=")).create(); + .withProperties(new ImageProperties().withImage("bXliYXNlNjRzdHJpbmc=")) + .create(); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteSamples.java index ca298c7ffa88c..dfa862a0c4b84 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteSamples.java @@ -18,7 +18,8 @@ public final class ImagesDeleteSamples { * @param manager Entry point to AzureSphereManager. */ public static void imagesDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.images().delete("MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", - com.azure.core.util.Context.NONE); + manager.images() + .delete("MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesGetSamples.java index 5941a50677feb..6a23a8e19efdc 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesGetSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesGetSamples.java @@ -18,7 +18,8 @@ public final class ImagesGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void imagesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.images().getWithResponse("MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", - com.azure.core.util.Context.NONE); + manager.images() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogSamples.java index d3afc98bbd240..13473dfdec272 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogSamples.java @@ -18,7 +18,7 @@ public final class ImagesListByCatalogSamples { * @param manager Entry point to AzureSphereManager. */ public static void imagesListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.images().listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, - com.azure.core.util.Context.NONE); + manager.images() + .listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesSamples.java index 0929cda53110b..c51e8465508b8 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesSamples.java @@ -19,7 +19,7 @@ public final class ProductsCountDevicesSamples { * @param manager Entry point to AzureSphereManager. */ public static void productsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.products().countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - com.azure.core.util.Context.NONE); + manager.products() + .countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsSamples.java index ed749735aac97..279c4b9c221a9 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsSamples.java @@ -19,7 +19,8 @@ public final class ProductsGenerateDefaultDeviceGroupsSamples { */ public static void productsGenerateDefaultDeviceGroups(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.products().generateDefaultDeviceGroups("MyResourceGroup1", "MyCatalog1", "MyProduct1", - com.azure.core.util.Context.NONE); + manager.products() + .generateDefaultDeviceGroups("MyResourceGroup1", "MyCatalog1", "MyProduct1", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGetSamples.java index 02d84879b5931..c355f4377dcb6 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGetSamples.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGetSamples.java @@ -18,7 +18,7 @@ public final class ProductsGetSamples { * @param manager Entry point to AzureSphereManager. */ public static void productsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { - manager.products().getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", - com.azure.core.util.Context.NONE); + manager.products() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogListResultTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogListResultTests.java index 651fe551ade92..65084dba3fe25 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogListResultTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogListResultTests.java @@ -21,6 +21,7 @@ public void testDeserialize() throws Exception { .toObject(CatalogListResult.class); Assertions.assertEquals("zb", model.value().get(0).location()); Assertions.assertEquals("npqxuh", model.value().get(0).tags().get("vyq")); + Assertions.assertEquals("cputegjvwmfdats", model.nextLink()); } @org.junit.jupiter.api.Test @@ -28,10 +29,11 @@ public void testSerialize() throws Exception { CatalogListResult model = new CatalogListResult().withValue(Arrays.asList(new CatalogInner().withLocation("zb") .withTags(mapOf("vyq", "npqxuh", "tfwvukxgaudc", "iwbybrkxvdumjg", "napczwlokjy", "snhsjcnyejhkryh", "oxzjnchgejspod", "mkkvnip")) - .withProperties(new CatalogProperties()))); + .withProperties(new CatalogProperties()))).withNextLink("cputegjvwmfdats"); model = BinaryData.fromObject(model).toObject(CatalogListResult.class); Assertions.assertEquals("zb", model.value().get(0).location()); Assertions.assertEquals("npqxuh", model.value().get(0).tags().get("vyq")); + Assertions.assertEquals("cputegjvwmfdats", model.nextLink()); } // Use "Map.of" if available diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsCountDevicesWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsCountDevicesWithResponseMockTests.java index bee20abd1a904..9bf49fb8c0aee 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsCountDevicesWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsCountDevicesWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.CountDevicesResponse; -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 CatalogsCountDevicesWithResponseMockTests { @Test public void testCountDevicesWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":1560245881}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateMockTests.java index 86538d99cdf4e..14d5177b2428b 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateMockTests.java @@ -6,47 +6,28 @@ 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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Catalog; import com.azure.resourcemanager.sphere.models.CatalogProperties; -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 CatalogsCreateOrUpdateMockTests { @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\":{\"tenantId\":\"yngudivk\",\"provisioningState\":\"Succeeded\"},\"location\":\"bxqz\",\"tags\":{\"e\":\"jfauvjfdxxi\"},\"id\":\"vtcqaqtdo\",\"name\":\"mcbxvwvxysl\",\"type\":\"bhsfxob\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsDeleteMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsDeleteMockTests.java index c1fb06d165233..8ffee9ee88336 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsDeleteMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsDeleteMockTests.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.sphere.AzureSphereManager; -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 CatalogsDeleteMockTests { @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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupWithResponseMockTests.java index bd32cebd57dfa..b85a5ee9d6709 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Catalog; -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 CatalogsGetByResourceGroupWithResponseMockTests { @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\":{\"tenantId\":\"ag\",\"provisioningState\":\"Accepted\"},\"location\":\"elmqk\",\"tags\":{\"dhmdua\":\"hvljuahaquh\",\"pvfadmwsrcr\":\"aex\",\"fmisg\":\"vxpvgomz\"},\"id\":\"bnbbeldawkz\",\"name\":\"ali\",\"type\":\"urqhaka\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListByResourceGroupMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListByResourceGroupMockTests.java index 92324a43995cb..3736be42ed418 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListByResourceGroupMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListByResourceGroupMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Catalog; -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 CatalogsListByResourceGroupMockTests { @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\":{\"tenantId\":\"xy\",\"provisioningState\":\"Deleting\"},\"location\":\"yrxvwfudwpznt\",\"tags\":{\"ck\":\"zhlrqjb\",\"kyv\":\"rlhrxs\"},\"id\":\"ycanuzbpzkafku\",\"name\":\"b\",\"type\":\"rnwb\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsMockTests.java index 64173d8626106..8bfde429b343d 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Deployment; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; -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 CatalogsListDeploymentsMockTests { @Test public void testListDeployments() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"deploymentId\":\"jawgqwg\",\"deployedImages\":[{\"properties\":{\"image\":\"kxfbkpycgklwndn\",\"imageId\":\"dauwhvylwzbtd\",\"imageName\":\"ujznb\",\"regionalDataBoundary\":\"None\",\"uri\":\"uwprzql\",\"description\":\"ualupjmkh\",\"componentId\":\"obbc\",\"imageType\":\"CustomerBoardConfig\",\"provisioningState\":\"Updating\"},\"id\":\"riplrbpbewtg\",\"name\":\"fgb\",\"type\":\"c\"}],\"deploymentDateUtc\":\"2021-02-14T22:48:14Z\",\"provisioningState\":\"Accepted\"},\"id\":\"v\",\"name\":\"hjkbegibtnmxieb\",\"type\":\"waloayqcgwr\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsMockTests.java index a2da0febea508..cdf204ce5d4c5 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsMockTests.java @@ -6,12 +6,10 @@ 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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection; import com.azure.resourcemanager.sphere.models.DeviceGroup; @@ -19,37 +17,20 @@ import com.azure.resourcemanager.sphere.models.OSFeedType; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; import com.azure.resourcemanager.sphere.models.UpdatePolicy; -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 CatalogsListDeviceGroupsMockTests { @Test public void testListDeviceGroups() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"description\":\"iwwroyqbexrmc\",\"osFeedType\":\"RetailEval\",\"updatePolicy\":\"No3rdPartyAppUpdates\",\"allowCrashDumpsCollection\":\"Disabled\",\"regionalDataBoundary\":\"None\",\"hasDeployment\":true,\"provisioningState\":\"Accepted\"},\"id\":\"qsgzvahapj\",\"name\":\"zhpvgqzcjrvxd\",\"type\":\"zlmwlxkvugfhz\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsMockTests.java index 596c2df31c403..240c47df09d90 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.DeviceInsight; -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 CatalogsListDeviceInsightsMockTests { @Test public void testListDeviceInsights() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"deviceId\":\"skzbb\",\"description\":\"dzumveekg\",\"startTimestampUtc\":\"2021-02-08T12:29:03Z\",\"endTimestampUtc\":\"2021-07-01T08:04:50Z\",\"eventCategory\":\"zuhkfpbsjyof\",\"eventClass\":\"xl\",\"eventType\":\"us\",\"eventCount\":1856979158}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesMockTests.java index 3da1697709f66..a14ed5a866a5e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Device; -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 CatalogsListDevicesMockTests { @Test public void testListDevices() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"deviceId\":\"joya\",\"chipSku\":\"slyjpkiid\",\"lastAvailableOsVersion\":\"exznelixhnr\",\"lastInstalledOsVersion\":\"folhbnxknal\",\"lastOsUpdateUtc\":\"2021-06-16T03:28:56Z\",\"lastUpdateRequestUtc\":\"2021-05-05T13:18:41Z\",\"provisioningState\":\"Deleting\"},\"id\":\"tpnapnyiropuhpig\",\"name\":\"pgylg\",\"type\":\"git\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListMockTests.java index 7b4cf74a68184..ee9f7e47fe160 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CatalogsListMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Catalog; -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 CatalogsListMockTests { @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\":{\"tenantId\":\"nxdhbt\",\"provisioningState\":\"Provisioning\"},\"location\":\"ywpnvjt\",\"tags\":{\"abgy\":\"ermclfplphoxuscr\",\"qugxywpmueefjzwf\":\"psbjta\"},\"id\":\"kqujidsuyono\",\"name\":\"glaocq\",\"type\":\"tcc\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificateListResultTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificateListResultTests.java index a0c05cbbd6f7a..cf27aed5b76ff 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificateListResultTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificateListResultTests.java @@ -9,6 +9,7 @@ import com.azure.resourcemanager.sphere.models.CertificateListResult; import com.azure.resourcemanager.sphere.models.CertificateProperties; import java.util.Arrays; +import org.junit.jupiter.api.Assertions; public final class CertificateListResultTests { @org.junit.jupiter.api.Test @@ -16,14 +17,18 @@ public void testDeserialize() throws Exception { CertificateListResult model = BinaryData.fromString( "{\"value\":[{\"properties\":{\"certificate\":\"v\",\"status\":\"Inactive\",\"subject\":\"ihnhun\",\"thumbprint\":\"wjzrnfygxgisp\",\"expiryUtc\":\"2021-05-03T11:09:18Z\",\"notBeforeUtc\":\"2021-01-12T09:11:57Z\",\"provisioningState\":\"Accepted\"},\"id\":\"fublj\",\"name\":\"fxqeof\",\"type\":\"aeqjhqjbasvms\"},{\"properties\":{\"certificate\":\"ulngsntn\",\"status\":\"Expired\",\"subject\":\"zgcwrw\",\"thumbprint\":\"xxwr\",\"expiryUtc\":\"2021-07-19T21:40:35Z\",\"notBeforeUtc\":\"2021-04-09T18:31:52Z\",\"provisioningState\":\"Canceled\"},\"id\":\"qvkoc\",\"name\":\"cjdkwtnhxbnjbi\",\"type\":\"sqrglssainq\"},{\"properties\":{\"certificate\":\"nzl\",\"status\":\"Inactive\",\"subject\":\"ppeebvmgxsab\",\"thumbprint\":\"qduujitcjczdz\",\"expiryUtc\":\"2021-11-12T14:41:45Z\",\"notBeforeUtc\":\"2021-05-08T08:52:13Z\",\"provisioningState\":\"Deleting\"},\"id\":\"pdappds\",\"name\":\"dkvwrwjfe\",\"type\":\"snhu\"}],\"nextLink\":\"eltmrldhugjzzdat\"}") .toObject(CertificateListResult.class); + Assertions.assertEquals("eltmrldhugjzzdat", model.nextLink()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - CertificateListResult model = new CertificateListResult() - .withValue(Arrays.asList(new CertificateInner().withProperties(new CertificateProperties()), - new CertificateInner().withProperties(new CertificateProperties()), - new CertificateInner().withProperties(new CertificateProperties()))); + CertificateListResult model + = new CertificateListResult() + .withValue(Arrays.asList(new CertificateInner().withProperties(new CertificateProperties()), + new CertificateInner().withProperties(new CertificateProperties()), + new CertificateInner().withProperties(new CertificateProperties()))) + .withNextLink("eltmrldhugjzzdat"); model = BinaryData.fromObject(model).toObject(CertificateListResult.class); + Assertions.assertEquals("eltmrldhugjzzdat", model.nextLink()); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesGetWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesGetWithResponseMockTests.java index a4e9046720ee0..e40b786140b69 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesGetWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesGetWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Certificate; -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 CertificatesGetWithResponseMockTests { @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\":{\"certificate\":\"fthnzdn\",\"status\":\"Active\",\"subject\":\"nayqi\",\"thumbprint\":\"nduhavhqlkthum\",\"expiryUtc\":\"2021-08-13T06:24:50Z\",\"notBeforeUtc\":\"2021-04-19T22:18:17Z\",\"provisioningState\":\"Accepted\"},\"id\":\"duiertgcc\",\"name\":\"mvaolps\",\"type\":\"lqlfm\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogMockTests.java index 08c8b168d5646..68731c7dd05cc 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Certificate; -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 CertificatesListByCatalogMockTests { @Test public void testListByCatalog() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"certificate\":\"uvwbhsqfs\",\"status\":\"Expired\",\"subject\":\"jbi\",\"thumbprint\":\"bpybsrfbjf\",\"expiryUtc\":\"2021-07-05T13:20:17Z\",\"notBeforeUtc\":\"2021-10-31T01:03:52Z\",\"provisioningState\":\"Updating\"},\"id\":\"tpvjzbexilzznfqq\",\"name\":\"vwpm\",\"type\":\"taruoujmkcj\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainWithResponseMockTests.java index 67ad8b22fef45..dab51d61ec1de 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainWithResponseMockTests.java @@ -6,42 +6,23 @@ 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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.CertificateChainResponse; -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 CertificatesRetrieveCertChainWithResponseMockTests { @Test public void testRetrieveCertChainWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"certificateChain\":\"dvxzbncblylpst\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceWithResponseMockTests.java index 09911fd3a365b..ad5d4b9572610 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceRequest; import com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceResponse; -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 CertificatesRetrieveProofOfPossessionNonceWithResponseMockTests { @Test public void testRetrieveProofOfPossessionNonceWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"certificate\":\"mweriofzpy\",\"status\":\"Inactive\",\"subject\":\"wab\",\"thumbprint\":\"tshhszhedp\",\"expiryUtc\":\"2021-10-13T23:51:57Z\",\"notBeforeUtc\":\"2021-09-12T04:45:44Z\",\"provisioningState\":\"Succeeded\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentListResultTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentListResultTests.java index eb6600f03f0d0..697d0c3b2bab6 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentListResultTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentListResultTests.java @@ -20,14 +20,18 @@ public void testDeserialize() throws Exception { "{\"value\":[{\"properties\":{\"deploymentId\":\"jmkljavbqidtqajz\",\"deployedImages\":[{\"properties\":{},\"id\":\"u\",\"name\":\"jkrlkhbzhfepg\",\"type\":\"gqexzlocxs\"}],\"deploymentDateUtc\":\"2021-11-18T07:05:01Z\",\"provisioningState\":\"Canceled\"},\"id\":\"hhbcsglummajtjao\",\"name\":\"xobnbdxkqpxok\",\"type\":\"jionpimexgstxgc\"}],\"nextLink\":\"dg\"}") .toObject(DeploymentListResult.class); Assertions.assertEquals("jmkljavbqidtqajz", model.value().get(0).properties().deploymentId()); + Assertions.assertEquals("dg", model.nextLink()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - DeploymentListResult model = new DeploymentListResult().withValue(Arrays - .asList(new DeploymentInner().withProperties(new DeploymentProperties().withDeploymentId("jmkljavbqidtqajz") - .withDeployedImages(Arrays.asList(new ImageInner().withProperties(new ImageProperties())))))); + DeploymentListResult model = new DeploymentListResult() + .withValue(Arrays.asList( + new DeploymentInner().withProperties(new DeploymentProperties().withDeploymentId("jmkljavbqidtqajz") + .withDeployedImages(Arrays.asList(new ImageInner().withProperties(new ImageProperties())))))) + .withNextLink("dg"); model = BinaryData.fromObject(model).toObject(DeploymentListResult.class); Assertions.assertEquals("jmkljavbqidtqajz", model.value().get(0).properties().deploymentId()); + Assertions.assertEquals("dg", model.nextLink()); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateMockTests.java index f1f7ab2935829..5ca9298d2219f 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateMockTests.java @@ -6,49 +6,30 @@ 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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.fluent.models.ImageInner; import com.azure.resourcemanager.sphere.models.Deployment; import com.azure.resourcemanager.sphere.models.DeploymentProperties; import com.azure.resourcemanager.sphere.models.ImageProperties; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.util.Arrays; 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 DeploymentsCreateOrUpdateMockTests { @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\":{\"deploymentId\":\"wib\",\"deployedImages\":[{\"properties\":{\"image\":\"bhshfwpracstwity\",\"imageId\":\"evxccedcp\",\"imageName\":\"dyodnwzxltj\",\"regionalDataBoundary\":\"EU\",\"uri\":\"ltiugcxnavv\",\"description\":\"qiby\",\"componentId\":\"nyowxwlmdjrkvfg\",\"imageType\":\"FwConfig\",\"provisioningState\":\"Updating\"},\"id\":\"bodacizsjq\",\"name\":\"hkr\",\"type\":\"ibdeibq\"}],\"deploymentDateUtc\":\"2021-10-05T18:29:09Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"vxndz\",\"name\":\"mkrefajpjorwkq\",\"type\":\"yhgbijtjivfx\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteMockTests.java index f7ec2d46b8fc9..9bf65f164599f 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteMockTests.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.sphere.AzureSphereManager; -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 DeploymentsDeleteMockTests { @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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetWithResponseMockTests.java index 8d0d89467f3be..4cbfe81adbfae 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Deployment; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; -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 DeploymentsGetWithResponseMockTests { @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\":{\"deploymentId\":\"qdpfuvglsbjjca\",\"deployedImages\":[{\"properties\":{\"image\":\"t\",\"imageId\":\"dut\",\"imageName\":\"ormrlxqtvcofudfl\",\"regionalDataBoundary\":\"None\",\"uri\":\"u\",\"description\":\"dknnqvsazn\",\"componentId\":\"tor\",\"imageType\":\"Policy\",\"provisioningState\":\"Succeeded\"},\"id\":\"hmk\",\"name\":\"c\",\"type\":\"rauwjuetaebu\"},{\"properties\":{\"image\":\"dmovsm\",\"imageId\":\"xwabmqoe\",\"imageName\":\"ifrvtpu\",\"regionalDataBoundary\":\"None\",\"uri\":\"qlgkfbtn\",\"description\":\"aongbj\",\"componentId\":\"tujitcjedft\",\"imageType\":\"BaseSystemUpdateManifest\",\"provisioningState\":\"Updating\"},\"id\":\"ojvdcpzfoqo\",\"name\":\"i\",\"type\":\"ybxarzgszu\"}],\"deploymentDateUtc\":\"2021-07-26T12:22:12Z\",\"provisioningState\":\"Canceled\"},\"id\":\"opidoamciodh\",\"name\":\"haz\",\"type\":\"khnzbonlw\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupMockTests.java index 67c7d07dc4e1b..f1624f66b4d78 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Deployment; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; -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 DeploymentsListByDeviceGroupMockTests { @Test public void testListByDeviceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"deploymentId\":\"wmewzsyy\",\"deployedImages\":[{\"properties\":{\"image\":\"oibjudpfrxtrthz\",\"imageId\":\"ytdw\",\"imageName\":\"brqubp\",\"regionalDataBoundary\":\"None\",\"uri\":\"xiilivpdtiirqt\",\"description\":\"oaxoruzfgsqu\",\"componentId\":\"xrxxlep\",\"imageType\":\"OneBl\",\"provisioningState\":\"Deleting\"},\"id\":\"ezw\",\"name\":\"wnwxuqlcvyd\",\"type\":\"patdooaojkniodko\"},{\"properties\":{\"image\":\"wnujhemmsbvdk\",\"imageId\":\"odtji\",\"imageName\":\"wj\",\"regionalDataBoundary\":\"None\",\"uri\":\"kacjvefkdlfo\",\"description\":\"ggkfpagaowpul\",\"componentId\":\"blylsyxkqjnsj\",\"imageType\":\"UpdateCertStore\",\"provisioningState\":\"Succeeded\"},\"id\":\"gxsds\",\"name\":\"uem\",\"type\":\"sbzkf\"}],\"deploymentDateUtc\":\"2021-06-16T01:14:17Z\",\"provisioningState\":\"Failed\"},\"id\":\"nqicvinvkjjxdxrb\",\"name\":\"ukzclewyhmlwpaz\",\"type\":\"zpof\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupListResultTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupListResultTests.java index e5b28ebef77ca..5293fa9c4830e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupListResultTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupListResultTests.java @@ -27,6 +27,7 @@ public void testDeserialize() throws Exception { Assertions.assertEquals(AllowCrashDumpCollection.ENABLED, model.value().get(0).properties().allowCrashDumpsCollection()); Assertions.assertEquals(RegionalDataBoundary.NONE, model.value().get(0).properties().regionalDataBoundary()); + Assertions.assertEquals("sllr", model.nextLink()); } @org.junit.jupiter.api.Test @@ -46,7 +47,8 @@ public void testSerialize() throws Exception { .withOsFeedType(OSFeedType.RETAIL_EVAL) .withUpdatePolicy(UpdatePolicy.UPDATE_ALL) .withAllowCrashDumpsCollection(AllowCrashDumpCollection.ENABLED) - .withRegionalDataBoundary(RegionalDataBoundary.NONE)))); + .withRegionalDataBoundary(RegionalDataBoundary.NONE)))) + .withNextLink("sllr"); model = BinaryData.fromObject(model).toObject(DeviceGroupListResult.class); Assertions.assertEquals("oaeupfhyhltrpmo", model.value().get(0).properties().description()); Assertions.assertEquals(OSFeedType.RETAIL_EVAL, model.value().get(0).properties().osFeedType()); @@ -54,5 +56,6 @@ public void testSerialize() throws Exception { Assertions.assertEquals(AllowCrashDumpCollection.ENABLED, model.value().get(0).properties().allowCrashDumpsCollection()); Assertions.assertEquals(RegionalDataBoundary.NONE, model.value().get(0).properties().regionalDataBoundary()); + Assertions.assertEquals("sllr", model.nextLink()); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesWithResponseMockTests.java index a6fb911c7bbc6..e5a8901bb86e8 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.CountDevicesResponse; -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 DeviceGroupsCountDevicesWithResponseMockTests { @Test public void testCountDevicesWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":326673667}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateMockTests.java index c36a552948a94..4d68363ca839b 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateMockTests.java @@ -6,11 +6,9 @@ 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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection; import com.azure.resourcemanager.sphere.models.DeviceGroup; @@ -18,37 +16,20 @@ import com.azure.resourcemanager.sphere.models.OSFeedType; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; import com.azure.resourcemanager.sphere.models.UpdatePolicy; -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 DeviceGroupsCreateOrUpdateMockTests { @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\":{\"description\":\"oduhp\",\"osFeedType\":\"RetailEval\",\"updatePolicy\":\"No3rdPartyAppUpdates\",\"allowCrashDumpsCollection\":\"Enabled\",\"regionalDataBoundary\":\"EU\",\"hasDeployment\":false,\"provisioningState\":\"Succeeded\"},\"id\":\"qugjhkycube\",\"name\":\"dgssofwqmzqal\",\"type\":\"rmnjijpx\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteMockTests.java index 56e370c5bdf7f..48e5c1ad96e60 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteMockTests.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.sphere.AzureSphereManager; -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 DeviceGroupsDeleteMockTests { @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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetWithResponseMockTests.java index 790989bb083b9..f24f7acf9eb27 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetWithResponseMockTests.java @@ -6,48 +6,29 @@ 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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection; import com.azure.resourcemanager.sphere.models.DeviceGroup; import com.azure.resourcemanager.sphere.models.OSFeedType; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; import com.azure.resourcemanager.sphere.models.UpdatePolicy; -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 DeviceGroupsGetWithResponseMockTests { @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\":{\"description\":\"v\",\"osFeedType\":\"RetailEval\",\"updatePolicy\":\"No3rdPartyAppUpdates\",\"allowCrashDumpsCollection\":\"Disabled\",\"regionalDataBoundary\":\"None\",\"hasDeployment\":true,\"provisioningState\":\"Updating\"},\"id\":\"dxepxgyq\",\"name\":\"gvr\",\"type\":\"mnpkukghimdblxg\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductMockTests.java index 1f018b2ca9251..61de68c3b5805 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductMockTests.java @@ -6,49 +6,30 @@ 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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection; import com.azure.resourcemanager.sphere.models.DeviceGroup; import com.azure.resourcemanager.sphere.models.OSFeedType; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; import com.azure.resourcemanager.sphere.models.UpdatePolicy; -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 DeviceGroupsListByProductMockTests { @Test public void testListByProduct() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"description\":\"mqg\",\"osFeedType\":\"Retail\",\"updatePolicy\":\"No3rdPartyAppUpdates\",\"allowCrashDumpsCollection\":\"Enabled\",\"regionalDataBoundary\":\"None\",\"hasDeployment\":true,\"provisioningState\":\"Provisioning\"},\"id\":\"allatmelwuipic\",\"name\":\"jzkzi\",\"type\":\"gvvcnayrhyr\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceListResultTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceListResultTests.java index f4eada2463b19..477027ba9fe4a 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceListResultTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DeviceListResultTests.java @@ -18,6 +18,7 @@ public void testDeserialize() throws Exception { "{\"value\":[{\"properties\":{\"deviceId\":\"uxwgipwho\",\"chipSku\":\"wkgshwa\",\"lastAvailableOsVersion\":\"ixzbinjeputtmryw\",\"lastInstalledOsVersion\":\"zoqftiyqzrnkcqvy\",\"lastOsUpdateUtc\":\"2021-11-01T04:15:41Z\",\"lastUpdateRequestUtc\":\"2021-04-08T10:43:47Z\",\"provisioningState\":\"Provisioning\"},\"id\":\"cohoq\",\"name\":\"nwvlryavwhheunmm\",\"type\":\"hgyxzkonoc\"},{\"properties\":{\"deviceId\":\"klyaxuconu\",\"chipSku\":\"zf\",\"lastAvailableOsVersion\":\"eyp\",\"lastInstalledOsVersion\":\"rmjmwvvjektc\",\"lastOsUpdateUtc\":\"2021-04-14T12:00:30Z\",\"lastUpdateRequestUtc\":\"2021-03-21T19:21:01Z\",\"provisioningState\":\"Provisioning\"},\"id\":\"s\",\"name\":\"frzpwvlqdqgb\",\"type\":\"qylihkaetckt\"},{\"properties\":{\"deviceId\":\"ivfsnk\",\"chipSku\":\"uctqhjfbe\",\"lastAvailableOsVersion\":\"jcxerfuwu\",\"lastInstalledOsVersion\":\"txfvjrbirph\",\"lastOsUpdateUtc\":\"2020-12-25T01:34:04Z\",\"lastUpdateRequestUtc\":\"2021-09-05T13:55:56Z\",\"provisioningState\":\"Provisioning\"},\"id\":\"fnljky\",\"name\":\"xjvuujqgidokg\",\"type\":\"ljyoxgvcltb\"},{\"properties\":{\"deviceId\":\"c\",\"chipSku\":\"kjeszz\",\"lastAvailableOsVersion\":\"ijhtxf\",\"lastInstalledOsVersion\":\"xbf\",\"lastOsUpdateUtc\":\"2021-01-19T10:57:10Z\",\"lastUpdateRequestUtc\":\"2021-05-10T05:23:15Z\",\"provisioningState\":\"Failed\"},\"id\":\"vecxgodebfqkk\",\"name\":\"bmpukgriwflz\",\"type\":\"fbxzpuzycisp\"}],\"nextLink\":\"zahmgkbrpyydhibn\"}") .toObject(DeviceListResult.class); Assertions.assertEquals("uxwgipwho", model.value().get(0).properties().deviceId()); + Assertions.assertEquals("zahmgkbrpyydhibn", model.nextLink()); } @org.junit.jupiter.api.Test @@ -26,8 +27,10 @@ public void testSerialize() throws Exception { .withValue(Arrays.asList(new DeviceInner().withProperties(new DeviceProperties().withDeviceId("uxwgipwho")), new DeviceInner().withProperties(new DeviceProperties().withDeviceId("klyaxuconu")), new DeviceInner().withProperties(new DeviceProperties().withDeviceId("ivfsnk")), - new DeviceInner().withProperties(new DeviceProperties().withDeviceId("c")))); + new DeviceInner().withProperties(new DeviceProperties().withDeviceId("c")))) + .withNextLink("zahmgkbrpyydhibn"); model = BinaryData.fromObject(model).toObject(DeviceListResult.class); Assertions.assertEquals("uxwgipwho", model.value().get(0).properties().deviceId()); + Assertions.assertEquals("zahmgkbrpyydhibn", model.nextLink()); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateMockTests.java index c9286881c6008..87f73be3c1484 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Device; import com.azure.resourcemanager.sphere.models.DeviceProperties; -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 DevicesCreateOrUpdateMockTests { @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\":{\"deviceId\":\"lvez\",\"chipSku\":\"pqlmfe\",\"lastAvailableOsVersion\":\"erqwkyhkobopg\",\"lastInstalledOsVersion\":\"dkow\",\"lastOsUpdateUtc\":\"2021-04-05T06:25:25Z\",\"lastUpdateRequestUtc\":\"2021-01-20T13:15:44Z\",\"provisioningState\":\"Succeeded\"},\"id\":\"kbwcc\",\"name\":\"njv\",\"type\":\"dw\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteMockTests.java index ac35888be5922..d09cd94451ca2 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteMockTests.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.sphere.AzureSphereManager; -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 DevicesDeleteMockTests { @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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageMockTests.java index 3c60dd2860232..b04108336d862 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.CapabilityType; import com.azure.resourcemanager.sphere.models.GenerateCapabilityImageRequest; import com.azure.resourcemanager.sphere.models.SignedCapabilityImageResponse; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.util.Arrays; 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 DevicesGenerateCapabilityImageMockTests { @Test public void testGenerateCapabilityImage() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"image\":\"fi\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesGetWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesGetWithResponseMockTests.java index 8ffed7a26c47a..1c76342946ff9 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesGetWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesGetWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Device; -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 DevicesGetWithResponseMockTests { @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\":{\"deviceId\":\"ikpzimejza\",\"chipSku\":\"fzxiavrmb\",\"lastAvailableOsVersion\":\"nokixrjqcirgz\",\"lastInstalledOsVersion\":\"rlazszrnw\",\"lastOsUpdateUtc\":\"2021-07-10T05:57:56Z\",\"lastUpdateRequestUtc\":\"2021-03-11T03:05:15Z\",\"provisioningState\":\"Accepted\"},\"id\":\"pj\",\"name\":\"lwbtlhf\",\"type\":\"sj\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupMockTests.java index fc726ba328b4c..de256b25fb6d2 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Device; -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 DevicesListByDeviceGroupMockTests { @Test public void testListByDeviceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"deviceId\":\"o\",\"chipSku\":\"hjjklff\",\"lastAvailableOsVersion\":\"ouw\",\"lastInstalledOsVersion\":\"gzrf\",\"lastOsUpdateUtc\":\"2021-01-08T15:42:56Z\",\"lastUpdateRequestUtc\":\"2021-04-04T13:09:14Z\",\"provisioningState\":\"Canceled\"},\"id\":\"ikayuhqlbjbsybb\",\"name\":\"wrv\",\"type\":\"ldgmfpgvmpip\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImageListResultTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImageListResultTests.java index f0f7decf3ccea..50675334d6a43 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImageListResultTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImageListResultTests.java @@ -21,6 +21,7 @@ public void testDeserialize() throws Exception { Assertions.assertEquals("fouflmmnkzsmo", model.value().get(0).properties().image()); Assertions.assertEquals("glougpbk", model.value().get(0).properties().imageId()); Assertions.assertEquals(RegionalDataBoundary.NONE, model.value().get(0).properties().regionalDataBoundary()); + Assertions.assertEquals("rfidfvzwdz", model.nextLink()); } @org.junit.jupiter.api.Test @@ -31,10 +32,12 @@ public void testSerialize() throws Exception { .withRegionalDataBoundary(RegionalDataBoundary.NONE)), new ImageInner().withProperties(new ImageProperties().withImage("awrlyx") .withImageId("kcprbnw") - .withRegionalDataBoundary(RegionalDataBoundary.NONE)))); + .withRegionalDataBoundary(RegionalDataBoundary.NONE)))) + .withNextLink("rfidfvzwdz"); model = BinaryData.fromObject(model).toObject(ImageListResult.class); Assertions.assertEquals("fouflmmnkzsmo", model.value().get(0).properties().image()); Assertions.assertEquals("glougpbk", model.value().get(0).properties().imageId()); Assertions.assertEquals(RegionalDataBoundary.NONE, model.value().get(0).properties().regionalDataBoundary()); + Assertions.assertEquals("rfidfvzwdz", model.nextLink()); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateMockTests.java index e91215f125bc7..e0f8ba1019062 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Image; import com.azure.resourcemanager.sphere.models.ImageProperties; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; -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 ImagesCreateOrUpdateMockTests { @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\":{\"image\":\"vqtmnub\",\"imageId\":\"kpzksmondjmq\",\"imageName\":\"vypomgkopkwho\",\"regionalDataBoundary\":\"EU\",\"uri\":\"jqg\",\"description\":\"smocmbq\",\"componentId\":\"vmkcx\",\"imageType\":\"Nwfs\",\"provisioningState\":\"Succeeded\"},\"id\":\"elxprglyatddck\",\"name\":\"bcuejrjxgci\",\"type\":\"ibrhosxsdqr\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteMockTests.java index 2d6e4d3c75756..bb01645aae5d7 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteMockTests.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.sphere.AzureSphereManager; -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 ImagesDeleteMockTests { @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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesGetWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesGetWithResponseMockTests.java index 84c9637498153..256df3400fb01 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesGetWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesGetWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Image; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; -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 ImagesGetWithResponseMockTests { @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\":{\"image\":\"lkfg\",\"imageId\":\"dneu\",\"imageName\":\"fphsdyhtozfikdow\",\"regionalDataBoundary\":\"None\",\"uri\":\"v\",\"description\":\"xclvit\",\"componentId\":\"qzonosggbhcohf\",\"imageType\":\"OneBl\",\"provisioningState\":\"Accepted\"},\"id\":\"aljutiiswac\",\"name\":\"fgdkzzew\",\"type\":\"fvhqc\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogMockTests.java index 12c1d7b9506f5..788492f7d2a0a 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Image; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; -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 ImagesListByCatalogMockTests { @Test public void testListByCatalog() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"image\":\"tfz\",\"imageId\":\"hhvh\",\"imageName\":\"r\",\"regionalDataBoundary\":\"EU\",\"uri\":\"wobdagxtibqdx\",\"description\":\"wakbogqxndl\",\"componentId\":\"gxhuriplbp\",\"imageType\":\"Services\",\"provisioningState\":\"Deleting\"},\"id\":\"bebxmubyyntwl\",\"name\":\"bqtkoievseotgqr\",\"type\":\"ltmuwlauwzizx\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/OperationsListMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/OperationsListMockTests.java index e7115da82ff25..e11459dbf5ef3 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/OperationsListMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.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\":\"hjjdhtldwkyzxuut\",\"isDataAction\":true,\"display\":{\"provider\":\"cwsvlxotog\",\"resource\":\"rupqsxvnmicy\",\"operation\":\"ceoveilovno\",\"description\":\"fj\"},\"origin\":\"user,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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/PagedDeviceInsightTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/PagedDeviceInsightTests.java index 7848b558816f1..0928aecbdd13c 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/PagedDeviceInsightTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/PagedDeviceInsightTests.java @@ -25,6 +25,7 @@ public void testDeserialize() throws Exception { Assertions.assertEquals("vxieduugidyj", model.value().get(0).eventClass()); Assertions.assertEquals("rfbyaosvexcso", model.value().get(0).eventType()); Assertions.assertEquals(771742090, model.value().get(0).eventCount()); + Assertions.assertEquals("gukgjnpiucgygevq", model.nextLink()); } @org.junit.jupiter.api.Test @@ -53,7 +54,8 @@ public void testSerialize() throws Exception { .withEventCategory("nkoukn") .withEventClass("udwtiukbl") .withEventType("ngkpocipazy") - .withEventCount(212177726))); + .withEventCount(212177726))) + .withNextLink("gukgjnpiucgygevq"); model = BinaryData.fromObject(model).toObject(PagedDeviceInsight.class); Assertions.assertEquals("rsa", model.value().get(0).deviceId()); Assertions.assertEquals("iwkuofos", model.value().get(0).description()); @@ -63,5 +65,6 @@ public void testSerialize() throws Exception { Assertions.assertEquals("vxieduugidyj", model.value().get(0).eventClass()); Assertions.assertEquals("rfbyaosvexcso", model.value().get(0).eventType()); Assertions.assertEquals(771742090, model.value().get(0).eventCount()); + Assertions.assertEquals("gukgjnpiucgygevq", model.nextLink()); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductListResultTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductListResultTests.java index f720a65ce7e6f..5c8e716550e92 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductListResultTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductListResultTests.java @@ -18,13 +18,17 @@ public void testDeserialize() throws Exception { "{\"value\":[{\"properties\":{\"description\":\"qpuedckzywbiex\",\"provisioningState\":\"Provisioning\"},\"id\":\"ue\",\"name\":\"xibxujwbhqwalm\",\"type\":\"zyoxaepdkzjan\"}],\"nextLink\":\"xrhdwbavxbniwdjs\"}") .toObject(ProductListResult.class); Assertions.assertEquals("qpuedckzywbiex", model.value().get(0).properties().description()); + Assertions.assertEquals("xrhdwbavxbniwdjs", model.nextLink()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ProductListResult model = new ProductListResult().withValue(Arrays - .asList(new ProductInner().withProperties(new ProductProperties().withDescription("qpuedckzywbiex")))); + ProductListResult model = new ProductListResult() + .withValue(Arrays + .asList(new ProductInner().withProperties(new ProductProperties().withDescription("qpuedckzywbiex")))) + .withNextLink("xrhdwbavxbniwdjs"); model = BinaryData.fromObject(model).toObject(ProductListResult.class); Assertions.assertEquals("qpuedckzywbiex", model.value().get(0).properties().description()); + Assertions.assertEquals("xrhdwbavxbniwdjs", model.nextLink()); } } diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesWithResponseMockTests.java index 2daacb38b7d5f..24a5f7c7c0461 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.CountDevicesResponse; -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 ProductsCountDevicesWithResponseMockTests { @Test public void testCountDevicesWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":890415173}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsCreateOrUpdateMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsCreateOrUpdateMockTests.java index 2a0a8ca2f0b68..6e39695f3a608 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsCreateOrUpdateMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsCreateOrUpdateMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Product; import com.azure.resourcemanager.sphere.models.ProductProperties; -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 ProductsCreateOrUpdateMockTests { @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\":{\"description\":\"g\",\"provisioningState\":\"Succeeded\"},\"id\":\"mabiknsorgjhxb\",\"name\":\"dtlwwrlkd\",\"type\":\"tncvokot\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsDeleteMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsDeleteMockTests.java index 48ef28af10e25..0896714a1a08b 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsDeleteMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsDeleteMockTests.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.sphere.AzureSphereManager; -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 ProductsDeleteMockTests { @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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsMockTests.java index 8506ffb2b105c..c69d0df3a5b2e 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsMockTests.java @@ -6,49 +6,30 @@ 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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection; import com.azure.resourcemanager.sphere.models.DeviceGroup; import com.azure.resourcemanager.sphere.models.OSFeedType; import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; import com.azure.resourcemanager.sphere.models.UpdatePolicy; -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 ProductsGenerateDefaultDeviceGroupsMockTests { @Test public void testGenerateDefaultDeviceGroups() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"description\":\"qkacewii\",\"osFeedType\":\"Retail\",\"updatePolicy\":\"No3rdPartyAppUpdates\",\"allowCrashDumpsCollection\":\"Disabled\",\"regionalDataBoundary\":\"EU\",\"hasDeployment\":true,\"provisioningState\":\"Updating\"},\"id\":\"hqkvpuvksgplsak\",\"name\":\"ynfs\",\"type\":\"n\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsGetWithResponseMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsGetWithResponseMockTests.java index 699382970cf98..9a2f3a39ed8dc 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsGetWithResponseMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsGetWithResponseMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Product; -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 ProductsGetWithResponseMockTests { @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\":{\"description\":\"yuq\",\"provisioningState\":\"Provisioning\"},\"id\":\"lp\",\"name\":\"wcciuqgbdbu\",\"type\":\"auvfbtkuwhhmhyk\"}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsListByCatalogMockTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsListByCatalogMockTests.java index 6a8fc4b9db18c..61a6cdbb582a5 100644 --- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsListByCatalogMockTests.java +++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/generated/ProductsListByCatalogMockTests.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.sphere.AzureSphereManager; import com.azure.resourcemanager.sphere.models.Product; -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 ProductsListByCatalogMockTests { @Test public void testListByCatalog() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"description\":\"oqac\",\"provisioningState\":\"Accepted\"},\"id\":\"pbtg\",\"name\":\"wbwo\",\"type\":\"nwashrtd\"}]}"; - 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))); AzureSphereManager manager = AzureSphereManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),