From c414b3a66ca1ac4cfbd348d02254a82eb6194454 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:45:04 -0800 Subject: [PATCH] [Automation] Generate Fluent Lite from Swagger fist#package-2024-01-10 (#43475) --- eng/versioning/version_client.txt | 2 +- .../CHANGELOG.md | 41 ++- .../README.md | 20 +- .../SAMPLE.md | 190 ++++++++----- .../pom.xml | 3 +- .../IoTFirmwareDefenseManager.java | 6 +- .../models/BinaryHardeningFeatures.java | 61 ++++- .../models/BinaryHardeningResourceInner.java | 97 ++++++- .../fluent/models/BinaryHardeningResult.java | 69 ++++- .../fluent/models/CryptoCertificate.java | 128 +++++++-- .../CryptoCertificateResourceInner.java | 98 ++++++- .../fluent/models/CryptoKey.java | 74 ++++- .../fluent/models/CryptoKeyResourceInner.java | 97 ++++++- .../fluent/models/CveResourceInner.java | 97 ++++++- .../fluent/models/CveResult.java | 85 +++++- .../fluent/models/FirmwareInner.java | 97 ++++++- .../fluent/models/FirmwareProperties.java | 78 +++++- .../fluent/models/OperationInner.java | 57 +++- .../fluent/models/PasswordHash.java | 69 ++++- .../models/PasswordHashResourceInner.java | 97 ++++++- .../fluent/models/SbomComponent.java | 62 ++++- .../models/SbomComponentResourceInner.java | 97 ++++++- .../fluent/models/SummaryResourceInner.java | 96 ++++++- .../fluent/models/UrlTokenInner.java | 44 ++- .../fluent/models/WorkspaceInner.java | 104 ++++++- .../fluent/models/WorkspaceProperties.java | 45 ++- .../BinaryHardeningsClientImpl.java | 12 +- .../CryptoCertificatesClientImpl.java | 8 +- .../implementation/CryptoKeysClientImpl.java | 8 +- .../implementation/CvesClientImpl.java | 8 +- .../implementation/FirmwaresClientImpl.java | 8 +- .../IoTFirmwareDefenseImpl.java | 3 +- .../implementation/OperationsClientImpl.java | 8 +- .../PasswordHashesClientImpl.java | 8 +- .../implementation/ResourceManagerUtils.java | 2 - .../SbomComponentsClientImpl.java | 8 +- .../implementation/SummariesClientImpl.java | 8 +- .../implementation/WorkspacesClientImpl.java | 16 +- .../iotfirmwaredefense/models/ActionType.java | 2 - .../models/BinaryHardeningListResult.java | 50 +++- .../BinaryHardeningSummaryResource.java | 86 +++++- .../models/CryptoCertificateEntity.java | 61 ++++- .../models/CryptoCertificateListResult.java | 50 +++- .../CryptoCertificateSummaryResource.java | 93 ++++++- .../models/CryptoKeyListResult.java | 50 +++- .../models/CryptoKeySummaryResource.java | 81 +++++- .../models/CveComponent.java | 53 +++- .../iotfirmwaredefense/models/CveLink.java | 49 +++- .../models/CveListResult.java | 49 +++- .../iotfirmwaredefense/models/CveSummary.java | 81 +++++- .../models/FirmwareList.java | 49 +++- .../models/FirmwareSummary.java | 89 +++++- .../models/FirmwareUpdateDefinition.java | 45 ++- .../models/GenerateUploadUrlRequest.java | 45 ++- .../models/OperationDisplay.java | 65 ++++- .../models/OperationListResult.java | 52 +++- .../iotfirmwaredefense/models/Origin.java | 2 - .../iotfirmwaredefense/models/PairedKey.java | 49 +++- .../models/PasswordHashListResult.java | 50 +++- .../models/ProvisioningState.java | 2 - .../models/SbomComponentListResult.java | 50 +++- .../iotfirmwaredefense/models/Status.java | 2 - .../models/StatusMessage.java | 49 +++- .../models/SummaryListResult.java | 50 +++- .../models/SummaryName.java | 2 - .../models/SummaryResourceProperties.java | 105 +++++-- .../models/SummaryType.java | 2 - .../models/WorkspaceList.java | 49 +++- .../models/WorkspaceUpdateDefinition.java | 45 ++- .../src/main/java/module-info.java | 4 +- .../proxy-config.json | 2 +- .../reflect-config.json | 257 +----------------- .../BinaryHardeningListByFirmwareSamples.java | 10 +- ...yptoCertificatesListByFirmwareSamples.java | 10 +- .../CryptoKeysListByFirmwareSamples.java | 10 +- .../generated/CvesListByFirmwareSamples.java | 10 +- .../generated/FirmwaresCreateSamples.java | 16 +- .../generated/FirmwaresDeleteSamples.java | 8 +- .../FirmwaresGenerateDownloadUrlSamples.java | 10 +- ...sGenerateFilesystemDownloadUrlSamples.java | 10 +- .../generated/FirmwaresGetSamples.java | 8 +- .../generated/FirmwaresUpdateSamples.java | 19 +- .../PasswordHashesListByFirmwareSamples.java | 10 +- .../SbomComponentsListByFirmwareSamples.java | 10 +- .../generated/SummariesGetSamples.java | 10 +- .../SummariesListByFirmwareSamples.java | 10 +- .../generated/WorkspacesCreateSamples.java | 15 +- .../generated/WorkspacesDeleteSamples.java | 8 +- .../WorkspacesGenerateUploadUrlSamples.java | 10 +- .../generated/WorkspacesUpdateSamples.java | 6 +- ...naryHardeningsListByFirmwareMockTests.java | 25 +- .../CvesListByFirmwareMockTests.java | 25 +- .../FirmwaresDeleteWithResponseMockTests.java | 25 +- ...erateDownloadUrlWithResponseMockTests.java | 25 +- ...ystemDownloadUrlWithResponseMockTests.java | 25 +- .../generated/OperationsListMockTests.java | 25 +- ...SbomComponentsListByFirmwareMockTests.java | 25 +- .../SummariesGetWithResponseMockTests.java | 25 +- .../SummariesListByFirmwareMockTests.java | 25 +- ...WorkspacesCreateWithResponseMockTests.java | 25 +- ...eByResourceGroupWithResponseMockTests.java | 25 +- ...enerateUploadUrlWithResponseMockTests.java | 25 +- ...tByResourceGroupWithResponseMockTests.java | 25 +- ...orkspacesListByResourceGroupMockTests.java | 25 +- .../generated/WorkspacesListMockTests.java | 25 +- 105 files changed, 3223 insertions(+), 1123 deletions(-) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 9828d99ce6eee..8dcd16b798a08 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -443,7 +443,7 @@ com.azure.resourcemanager:azure-resourcemanager-networkcloud;1.0.0;1.1.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-cosmosdbforpostgresql;1.0.0;1.1.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-managementgroups;1.0.0-beta.2;1.0.0-beta.3 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-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-chaos;1.1.0;1.2.0-beta.1 diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/CHANGELOG.md b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/CHANGELOG.md index 3eb2e20a1d75e..2605b204133fd 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/CHANGELOG.md +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/CHANGELOG.md @@ -1,14 +1,47 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0 (2024-12-19) -### Features Added +- Azure Resource Manager IoT Firmware Defense client library for Java. This package contains Microsoft Azure SDK for IoT Firmware Defense Management SDK. Firmware & IoT Security REST API. Package tag package-2024-01-10. 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.CveSummary` was modified + +* `summaryType()` was added + +#### `models.SummaryResourceProperties` was modified + +* `summaryType()` was added + +#### `models.CryptoCertificateSummaryResource` was modified + +* `summaryType()` was added + +#### `models.BinaryHardeningSummaryResource` was modified + +* `summaryType()` was added + +#### `models.CryptoKeySummaryResource` was modified + +* `summaryType()` was added + +#### `models.FirmwareSummary` was modified -### Other Changes +* `summaryType()` was added ## 1.0.0 (2024-03-18) diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/README.md b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/README.md index 2444da68044d9..dd1cc7d5785d7 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/README.md +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-iotfirmwaredefense - 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 +workspace = ioTFirmwareDefenseManager.workspaces() + .define(spaceName) + .withRegion(REGION) + .withExistingResourceGroup(resourceGroupName) + .create(); +``` [Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/SAMPLE.md b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/SAMPLE.md index f061a9295800d..61c558e5d4822 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/SAMPLE.md +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/SAMPLE.md @@ -71,8 +71,9 @@ public final class BinaryHardeningListByFirmwareSamples { */ public static void binaryHardeningListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.binaryHardenings().listByFirmware("FirmwareAnalysisRG", "default", - "109a9886-50bf-85a8-9d75-000000000000", com.azure.core.util.Context.NONE); + manager.binaryHardenings() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -86,8 +87,9 @@ public final class BinaryHardeningListByFirmwareSamples { */ public static void binaryHardeningListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.binaryHardenings().listByFirmware("FirmwareAnalysisRG", "default", - "109a9886-50bf-85a8-9d75-000000000000", com.azure.core.util.Context.NONE); + manager.binaryHardenings() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -110,8 +112,9 @@ public final class CryptoCertificatesListByFirmwareSamples { */ public static void cryptoCertificatesListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cryptoCertificates().listByFirmware("FirmwareAnalysisRG", "default", - "109a9886-50bf-85a8-9d75-000000000000", com.azure.core.util.Context.NONE); + manager.cryptoCertificates() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -125,8 +128,9 @@ public final class CryptoCertificatesListByFirmwareSamples { */ public static void cryptoCertificatesListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cryptoCertificates().listByFirmware("FirmwareAnalysisRG", "default", - "109a9886-50bf-85a8-9d75-000000000000", com.azure.core.util.Context.NONE); + manager.cryptoCertificates() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -149,8 +153,9 @@ public final class CryptoKeysListByFirmwareSamples { */ public static void cryptoKeysListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cryptoKeys().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.cryptoKeys() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -164,8 +169,9 @@ public final class CryptoKeysListByFirmwareSamples { */ public static void cryptoKeysListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cryptoKeys().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.cryptoKeys() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -188,8 +194,9 @@ public final class CvesListByFirmwareSamples { */ public static void cvesListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cves().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.cves() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -203,8 +210,9 @@ public final class CvesListByFirmwareSamples { */ public static void cvesListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cves().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.cves() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -231,10 +239,18 @@ public final class FirmwaresCreateSamples { */ public static void firmwaresCreateMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().define("umrkdttp").withExistingWorkspace("rgworkspaces-firmwares", "A7") - .withFileName("wresexxulcdsdd").withVendor("vycmdhgtmepcptyoubztiuudpkcpd").withModel("f").withVersion("s") - .withDescription("uz").withFileSize(17L).withStatus(Status.PENDING) - .withStatusMessages(Arrays.asList(new StatusMessage().withMessage("ulvhmhokezathzzauiitu"))).create(); + manager.firmwares() + .define("umrkdttp") + .withExistingWorkspace("rgworkspaces-firmwares", "A7") + .withFileName("wresexxulcdsdd") + .withVendor("vycmdhgtmepcptyoubztiuudpkcpd") + .withModel("f") + .withVersion("s") + .withDescription("uz") + .withFileSize(17L) + .withStatus(Status.PENDING) + .withStatusMessages(Arrays.asList(new StatusMessage().withMessage("ulvhmhokezathzzauiitu"))) + .create(); } /* @@ -271,8 +287,8 @@ public final class FirmwaresDeleteSamples { */ public static void firmwaresDeleteMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().deleteWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .deleteWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE); } /* @@ -286,8 +302,8 @@ public final class FirmwaresDeleteSamples { */ public static void firmwaresDeleteMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().deleteWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .deleteWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE); } } ``` @@ -310,8 +326,9 @@ public final class FirmwaresGenerateDownloadUrlSamples { */ public static void firmwaresGenerateDownloadUrlMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().generateDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .generateDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", + com.azure.core.util.Context.NONE); } /* @@ -325,8 +342,9 @@ public final class FirmwaresGenerateDownloadUrlSamples { */ public static void firmwaresGenerateDownloadUrlMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().generateDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .generateDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", + com.azure.core.util.Context.NONE); } } ``` @@ -349,8 +367,9 @@ public final class FirmwaresGenerateFilesystemDownloadUrlSamples { */ public static void firmwaresGenerateFilesystemDownloadUrlMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().generateFilesystemDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .generateFilesystemDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", + com.azure.core.util.Context.NONE); } /* @@ -364,8 +383,9 @@ public final class FirmwaresGenerateFilesystemDownloadUrlSamples { */ public static void firmwaresGenerateFilesystemDownloadUrlMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().generateFilesystemDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .generateFilesystemDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", + com.azure.core.util.Context.NONE); } } ``` @@ -388,8 +408,8 @@ public final class FirmwaresGetSamples { */ public static void firmwaresGetMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE); } /* @@ -403,8 +423,8 @@ public final class FirmwaresGetSamples { */ public static void firmwaresGetMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE); } } ``` @@ -470,10 +490,18 @@ public final class FirmwaresUpdateSamples { public static void firmwaresUpdateMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { Firmware resource = manager.firmwares() - .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE).getValue(); - resource.update().withFileName("wresexxulcdsdd").withVendor("vycmdhgtmepcptyoubztiuudpkcpd").withModel("f") - .withVersion("s").withDescription("uz").withFileSize(17L).withStatus(Status.PENDING) - .withStatusMessages(Arrays.asList(new StatusMessage().withMessage("ulvhmhokezathzzauiitu"))).apply(); + .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withFileName("wresexxulcdsdd") + .withVendor("vycmdhgtmepcptyoubztiuudpkcpd") + .withModel("f") + .withVersion("s") + .withDescription("uz") + .withFileSize(17L) + .withStatus(Status.PENDING) + .withStatusMessages(Arrays.asList(new StatusMessage().withMessage("ulvhmhokezathzzauiitu"))) + .apply(); } /* @@ -488,7 +516,8 @@ public final class FirmwaresUpdateSamples { public static void firmwaresUpdateMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { Firmware resource = manager.firmwares() - .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE).getValue(); + .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } @@ -549,8 +578,9 @@ public final class PasswordHashesListByFirmwareSamples { */ public static void passwordHashesListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.passwordHashes().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.passwordHashes() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -564,8 +594,9 @@ public final class PasswordHashesListByFirmwareSamples { */ public static void passwordHashesListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.passwordHashes().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.passwordHashes() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -588,8 +619,9 @@ public final class SbomComponentsListByFirmwareSamples { */ public static void sbomComponentsListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.sbomComponents().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.sbomComponents() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -603,8 +635,9 @@ public final class SbomComponentsListByFirmwareSamples { */ public static void sbomComponentsListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.sbomComponents().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.sbomComponents() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -629,8 +662,9 @@ public final class SummariesGetSamples { */ public static void summariesGetMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.summaries().getWithResponse("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - SummaryName.FIRMWARE, com.azure.core.util.Context.NONE); + manager.summaries() + .getWithResponse("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + SummaryName.FIRMWARE, com.azure.core.util.Context.NONE); } /* @@ -644,8 +678,9 @@ public final class SummariesGetSamples { */ public static void summariesGetMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.summaries().getWithResponse("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - SummaryName.FIRMWARE, com.azure.core.util.Context.NONE); + manager.summaries() + .getWithResponse("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + SummaryName.FIRMWARE, com.azure.core.util.Context.NONE); } } ``` @@ -668,8 +703,9 @@ public final class SummariesListByFirmwareSamples { */ public static void summariesListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.summaries().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.summaries() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -683,8 +719,9 @@ public final class SummariesListByFirmwareSamples { */ public static void summariesListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.summaries().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.summaries() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -710,8 +747,11 @@ public final class WorkspacesCreateSamples { */ public static void workspacesCreateMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().define("E___-3").withRegion("jjwbseilitjgdrhbvvkwviqj") - .withExistingResourceGroup("rgworkspaces").create(); + manager.workspaces() + .define("E___-3") + .withRegion("jjwbseilitjgdrhbvvkwviqj") + .withExistingResourceGroup("rgworkspaces") + .create(); } /* @@ -725,8 +765,12 @@ public final class WorkspacesCreateSamples { */ public static void workspacesCreateMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().define("E___-3").withRegion("jjwbseilitjgdrhbvvkwviqj") - .withExistingResourceGroup("rgworkspaces").withTags(mapOf("key450", "fakeTokenPlaceholder")).create(); + manager.workspaces() + .define("E___-3") + .withRegion("jjwbseilitjgdrhbvvkwviqj") + .withExistingResourceGroup("rgworkspaces") + .withTags(mapOf("key450", "fakeTokenPlaceholder")) + .create(); } // Use "Map.of" if available @@ -761,8 +805,8 @@ public final class WorkspacesDeleteSamples { */ public static void workspacesDeleteMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().deleteByResourceGroupWithResponse("rgworkspaces", "E___-3", - com.azure.core.util.Context.NONE); + manager.workspaces() + .deleteByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE); } /* @@ -776,8 +820,8 @@ public final class WorkspacesDeleteSamples { */ public static void workspacesDeleteMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().deleteByResourceGroupWithResponse("rgworkspaces", "E___-3", - com.azure.core.util.Context.NONE); + manager.workspaces() + .deleteByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE); } } ``` @@ -802,8 +846,9 @@ public final class WorkspacesGenerateUploadUrlSamples { */ public static void workspacesGenerateUploadUrlMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().generateUploadUrlWithResponse("rgworkspaces", "E___-3", new GenerateUploadUrlRequest(), - com.azure.core.util.Context.NONE); + manager.workspaces() + .generateUploadUrlWithResponse("rgworkspaces", "E___-3", new GenerateUploadUrlRequest(), + com.azure.core.util.Context.NONE); } /* @@ -817,8 +862,9 @@ public final class WorkspacesGenerateUploadUrlSamples { */ public static void workspacesGenerateUploadUrlMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().generateUploadUrlWithResponse("rgworkspaces", "E___-3", - new GenerateUploadUrlRequest().withFirmwareId("ytsfprbywi"), com.azure.core.util.Context.NONE); + manager.workspaces() + .generateUploadUrlWithResponse("rgworkspaces", "E___-3", + new GenerateUploadUrlRequest().withFirmwareId("ytsfprbywi"), com.azure.core.util.Context.NONE); } } ``` @@ -955,7 +1001,8 @@ public final class WorkspacesUpdateSamples { public static void workspacesUpdateMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { Workspace resource = manager.workspaces() - .getByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE).getValue(); + .getByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } @@ -971,7 +1018,8 @@ public final class WorkspacesUpdateSamples { public static void workspacesUpdateMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { Workspace resource = manager.workspaces() - .getByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE).getValue(); + .getByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/pom.xml b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/pom.xml index b574eb51cc0a6..b0d4fcfeefcf5 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/pom.xml +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-iotfirmwaredefense - 1.1.0-beta.1 + 1.1.0 jar Microsoft Azure SDK for IoT Firmware Defense Management @@ -45,6 +45,7 @@ UTF-8 0 0 + false diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/IoTFirmwareDefenseManager.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/IoTFirmwareDefenseManager.java index fb91751f15efd..bb4bc6a30d1af 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/IoTFirmwareDefenseManager.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/IoTFirmwareDefenseManager.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; @@ -241,7 +241,7 @@ public IoTFirmwareDefenseManager authenticate(TokenCredential credential, AzureP .append("-") .append("com.azure.resourcemanager.iotfirmwaredefense") .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")) @@ -274,7 +274,7 @@ public IoTFirmwareDefenseManager authenticate(TokenCredential credential, AzureP 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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningFeatures.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningFeatures.java index e9f07a37166f1..f2ffd3b89fd6e 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningFeatures.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningFeatures.java @@ -5,41 +5,40 @@ package com.azure.resourcemanager.iotfirmwaredefense.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Binary hardening features. */ @Fluent -public final class BinaryHardeningFeatures { +public final class BinaryHardeningFeatures implements JsonSerializable { /* * NX (no-execute) flag. */ - @JsonProperty(value = "nx") private Boolean nx; /* * PIE (position independent executable) flag. */ - @JsonProperty(value = "pie") private Boolean pie; /* * RELRO (relocation read-only) flag. */ - @JsonProperty(value = "relro") private Boolean relro; /* * Canary (stack canaries) flag. */ - @JsonProperty(value = "canary") private Boolean canary; /* * Stripped flag. */ - @JsonProperty(value = "stripped") private Boolean stripped; /** @@ -155,4 +154,52 @@ public BinaryHardeningFeatures withStripped(Boolean stripped) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("nx", this.nx); + jsonWriter.writeBooleanField("pie", this.pie); + jsonWriter.writeBooleanField("relro", this.relro); + jsonWriter.writeBooleanField("canary", this.canary); + jsonWriter.writeBooleanField("stripped", this.stripped); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BinaryHardeningFeatures from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BinaryHardeningFeatures 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 BinaryHardeningFeatures. + */ + public static BinaryHardeningFeatures fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryHardeningFeatures deserializedBinaryHardeningFeatures = new BinaryHardeningFeatures(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nx".equals(fieldName)) { + deserializedBinaryHardeningFeatures.nx = reader.getNullable(JsonReader::getBoolean); + } else if ("pie".equals(fieldName)) { + deserializedBinaryHardeningFeatures.pie = reader.getNullable(JsonReader::getBoolean); + } else if ("relro".equals(fieldName)) { + deserializedBinaryHardeningFeatures.relro = reader.getNullable(JsonReader::getBoolean); + } else if ("canary".equals(fieldName)) { + deserializedBinaryHardeningFeatures.canary = reader.getNullable(JsonReader::getBoolean); + } else if ("stripped".equals(fieldName)) { + deserializedBinaryHardeningFeatures.stripped = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedBinaryHardeningFeatures; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningResourceInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningResourceInner.java index 443c1b36cedd8..cdfe3c6fcb0e7 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningResourceInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningResourceInner.java @@ -7,7 +7,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * binary hardening analysis result resource. @@ -17,15 +20,28 @@ public final class BinaryHardeningResourceInner extends ProxyResource { /* * The properties of a binary hardening result found within a firmware image */ - @JsonProperty(value = "properties") private BinaryHardeningResult innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of BinaryHardeningResourceInner class. */ @@ -50,6 +66,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the binaryHardeningId property: ID for the binary hardening result. * @@ -313,4 +359,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BinaryHardeningResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BinaryHardeningResourceInner 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 BinaryHardeningResourceInner. + */ + public static BinaryHardeningResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryHardeningResourceInner deserializedBinaryHardeningResourceInner = new BinaryHardeningResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBinaryHardeningResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBinaryHardeningResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBinaryHardeningResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedBinaryHardeningResourceInner.innerProperties = BinaryHardeningResult.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedBinaryHardeningResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBinaryHardeningResourceInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningResult.java index dc31bef3f0972..bfd90b2bb1575 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/BinaryHardeningResult.java @@ -5,53 +5,50 @@ package com.azure.resourcemanager.iotfirmwaredefense.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Binary hardening of a firmware. */ @Fluent -public final class BinaryHardeningResult { +public final class BinaryHardeningResult implements JsonSerializable { /* * ID for the binary hardening result. */ - @JsonProperty(value = "binaryHardeningId") private String binaryHardeningId; /* * Binary hardening features. */ - @JsonProperty(value = "features") private BinaryHardeningFeatures innerFeatures; /* * The architecture of the uploaded firmware. */ - @JsonProperty(value = "architecture") private String architecture; /* * The executable path. */ - @JsonProperty(value = "filePath") private String filePath; /* * The executable class to indicate 32 or 64 bit. */ - @JsonProperty(value = "class") private String classProperty; /* * The runpath of the uploaded firmware. */ - @JsonProperty(value = "runpath") private String runpath; /* * The rpath of the uploaded firmware. */ - @JsonProperty(value = "rpath") private String rpath; /** @@ -314,4 +311,58 @@ public void validate() { innerFeatures().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("binaryHardeningId", this.binaryHardeningId); + jsonWriter.writeJsonField("features", this.innerFeatures); + jsonWriter.writeStringField("architecture", this.architecture); + jsonWriter.writeStringField("filePath", this.filePath); + jsonWriter.writeStringField("class", this.classProperty); + jsonWriter.writeStringField("runpath", this.runpath); + jsonWriter.writeStringField("rpath", this.rpath); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BinaryHardeningResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BinaryHardeningResult 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 BinaryHardeningResult. + */ + public static BinaryHardeningResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryHardeningResult deserializedBinaryHardeningResult = new BinaryHardeningResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("binaryHardeningId".equals(fieldName)) { + deserializedBinaryHardeningResult.binaryHardeningId = reader.getString(); + } else if ("features".equals(fieldName)) { + deserializedBinaryHardeningResult.innerFeatures = BinaryHardeningFeatures.fromJson(reader); + } else if ("architecture".equals(fieldName)) { + deserializedBinaryHardeningResult.architecture = reader.getString(); + } else if ("filePath".equals(fieldName)) { + deserializedBinaryHardeningResult.filePath = reader.getString(); + } else if ("class".equals(fieldName)) { + deserializedBinaryHardeningResult.classProperty = reader.getString(); + } else if ("runpath".equals(fieldName)) { + deserializedBinaryHardeningResult.runpath = reader.getString(); + } else if ("rpath".equals(fieldName)) { + deserializedBinaryHardeningResult.rpath = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBinaryHardeningResult; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoCertificate.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoCertificate.java index 996ccc9a5663f..72f91ea3505cf 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoCertificate.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoCertificate.java @@ -5,135 +5,121 @@ package com.azure.resourcemanager.iotfirmwaredefense.fluent.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.iotfirmwaredefense.models.CryptoCertificateEntity; import com.azure.resourcemanager.iotfirmwaredefense.models.PairedKey; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Crypto certificate properties. */ @Fluent -public final class CryptoCertificate { +public final class CryptoCertificate implements JsonSerializable { /* * ID for the certificate result. */ - @JsonProperty(value = "cryptoCertId") private String cryptoCertId; /* * Name of the certificate. */ - @JsonProperty(value = "name") private String name; /* * Subject information of the certificate. */ - @JsonProperty(value = "subject") private CryptoCertificateEntity subject; /* * Issuer information of the certificate. */ - @JsonProperty(value = "issuer") private CryptoCertificateEntity issuer; /* * Issue date for the certificate. */ - @JsonProperty(value = "issuedDate") private OffsetDateTime issuedDate; /* * Expiration date for the certificate. */ - @JsonProperty(value = "expirationDate") private OffsetDateTime expirationDate; /* * Role of the certificate (Root CA, etc) */ - @JsonProperty(value = "role") private String role; /* * The signature algorithm used in the certificate. */ - @JsonProperty(value = "signatureAlgorithm") private String signatureAlgorithm; /* * Size of the certificate's key in bits */ - @JsonProperty(value = "keySize") private Long keySize; /* * Key algorithm used in the certificate. */ - @JsonProperty(value = "keyAlgorithm") private String keyAlgorithm; /* * Encoding used for the certificate. */ - @JsonProperty(value = "encoding") private String encoding; /* * Serial number of the certificate. */ - @JsonProperty(value = "serialNumber") private String serialNumber; /* * Fingerprint of the certificate. */ - @JsonProperty(value = "fingerprint") private String fingerprint; /* * List of functions the certificate can fulfill. */ - @JsonProperty(value = "usage") private List usage; /* * List of files where this certificate was found. */ - @JsonProperty(value = "filePaths", access = JsonProperty.Access.WRITE_ONLY) private List filePaths; /* * A matching paired private key. */ - @JsonProperty(value = "pairedKey") private PairedKey pairedKey; /* * Indicates if the certificate is expired. */ - @JsonProperty(value = "isExpired") private Boolean isExpired; /* * Indicates if the certificate is self-signed. */ - @JsonProperty(value = "isSelfSigned") private Boolean isSelfSigned; /* * Indicates the signature algorithm used is insecure. */ - @JsonProperty(value = "isWeakSignature") private Boolean isWeakSignature; /* * Indicates the certificate's key size is considered too small to be secure for the key algorithm. */ - @JsonProperty(value = "isShortKeySize") private Boolean isShortKeySize; /** @@ -549,4 +535,102 @@ public void validate() { pairedKey().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cryptoCertId", this.cryptoCertId); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("subject", this.subject); + jsonWriter.writeJsonField("issuer", this.issuer); + jsonWriter.writeStringField("issuedDate", + this.issuedDate == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.issuedDate)); + jsonWriter.writeStringField("expirationDate", + this.expirationDate == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expirationDate)); + jsonWriter.writeStringField("role", this.role); + jsonWriter.writeStringField("signatureAlgorithm", this.signatureAlgorithm); + jsonWriter.writeNumberField("keySize", this.keySize); + jsonWriter.writeStringField("keyAlgorithm", this.keyAlgorithm); + jsonWriter.writeStringField("encoding", this.encoding); + jsonWriter.writeStringField("serialNumber", this.serialNumber); + jsonWriter.writeStringField("fingerprint", this.fingerprint); + jsonWriter.writeArrayField("usage", this.usage, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("pairedKey", this.pairedKey); + jsonWriter.writeBooleanField("isExpired", this.isExpired); + jsonWriter.writeBooleanField("isSelfSigned", this.isSelfSigned); + jsonWriter.writeBooleanField("isWeakSignature", this.isWeakSignature); + jsonWriter.writeBooleanField("isShortKeySize", this.isShortKeySize); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CryptoCertificate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CryptoCertificate 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 CryptoCertificate. + */ + public static CryptoCertificate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CryptoCertificate deserializedCryptoCertificate = new CryptoCertificate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cryptoCertId".equals(fieldName)) { + deserializedCryptoCertificate.cryptoCertId = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCryptoCertificate.name = reader.getString(); + } else if ("subject".equals(fieldName)) { + deserializedCryptoCertificate.subject = CryptoCertificateEntity.fromJson(reader); + } else if ("issuer".equals(fieldName)) { + deserializedCryptoCertificate.issuer = CryptoCertificateEntity.fromJson(reader); + } else if ("issuedDate".equals(fieldName)) { + deserializedCryptoCertificate.issuedDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("expirationDate".equals(fieldName)) { + deserializedCryptoCertificate.expirationDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("role".equals(fieldName)) { + deserializedCryptoCertificate.role = reader.getString(); + } else if ("signatureAlgorithm".equals(fieldName)) { + deserializedCryptoCertificate.signatureAlgorithm = reader.getString(); + } else if ("keySize".equals(fieldName)) { + deserializedCryptoCertificate.keySize = reader.getNullable(JsonReader::getLong); + } else if ("keyAlgorithm".equals(fieldName)) { + deserializedCryptoCertificate.keyAlgorithm = reader.getString(); + } else if ("encoding".equals(fieldName)) { + deserializedCryptoCertificate.encoding = reader.getString(); + } else if ("serialNumber".equals(fieldName)) { + deserializedCryptoCertificate.serialNumber = reader.getString(); + } else if ("fingerprint".equals(fieldName)) { + deserializedCryptoCertificate.fingerprint = reader.getString(); + } else if ("usage".equals(fieldName)) { + List usage = reader.readArray(reader1 -> reader1.getString()); + deserializedCryptoCertificate.usage = usage; + } else if ("filePaths".equals(fieldName)) { + List filePaths = reader.readArray(reader1 -> reader1.getString()); + deserializedCryptoCertificate.filePaths = filePaths; + } else if ("pairedKey".equals(fieldName)) { + deserializedCryptoCertificate.pairedKey = PairedKey.fromJson(reader); + } else if ("isExpired".equals(fieldName)) { + deserializedCryptoCertificate.isExpired = reader.getNullable(JsonReader::getBoolean); + } else if ("isSelfSigned".equals(fieldName)) { + deserializedCryptoCertificate.isSelfSigned = reader.getNullable(JsonReader::getBoolean); + } else if ("isWeakSignature".equals(fieldName)) { + deserializedCryptoCertificate.isWeakSignature = reader.getNullable(JsonReader::getBoolean); + } else if ("isShortKeySize".equals(fieldName)) { + deserializedCryptoCertificate.isShortKeySize = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedCryptoCertificate; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoCertificateResourceInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoCertificateResourceInner.java index 2b1d5af950e3f..052add1b449ef 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoCertificateResourceInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoCertificateResourceInner.java @@ -7,9 +7,12 @@ 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.iotfirmwaredefense.models.CryptoCertificateEntity; import com.azure.resourcemanager.iotfirmwaredefense.models.PairedKey; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -21,15 +24,28 @@ public final class CryptoCertificateResourceInner extends ProxyResource { /* * The properties of a crypto certificate found within a firmware image */ - @JsonProperty(value = "properties") private CryptoCertificate innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of CryptoCertificateResourceInner class. */ @@ -54,6 +70,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the cryptoCertId property: ID for the certificate result. * @@ -512,4 +558,50 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CryptoCertificateResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CryptoCertificateResourceInner 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 CryptoCertificateResourceInner. + */ + public static CryptoCertificateResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CryptoCertificateResourceInner deserializedCryptoCertificateResourceInner + = new CryptoCertificateResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCryptoCertificateResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCryptoCertificateResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCryptoCertificateResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCryptoCertificateResourceInner.innerProperties = CryptoCertificate.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCryptoCertificateResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCryptoCertificateResourceInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoKey.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoKey.java index c29fae1a42fdf..91b261ad7932d 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoKey.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoKey.java @@ -5,61 +5,57 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.models.PairedKey; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Crypto key properties. */ @Fluent -public final class CryptoKey { +public final class CryptoKey implements JsonSerializable { /* * ID for the key result. */ - @JsonProperty(value = "cryptoKeyId") private String cryptoKeyId; /* * Type of the key (public or private). */ - @JsonProperty(value = "keyType") private String keyType; /* * Size of the key in bits. */ - @JsonProperty(value = "keySize") private Long keySize; /* * Key algorithm name. */ - @JsonProperty(value = "keyAlgorithm") private String keyAlgorithm; /* * Functions the key can fulfill. */ - @JsonProperty(value = "usage") private List usage; /* * List of files where this key was found. */ - @JsonProperty(value = "filePaths", access = JsonProperty.Access.WRITE_ONLY) private List filePaths; /* * A matching paired key or certificate. */ - @JsonProperty(value = "pairedKey") private PairedKey pairedKey; /* * Indicates the key size is considered too small to be secure for the algorithm. */ - @JsonProperty(value = "isShortKeySize") private Boolean isShortKeySize; /** @@ -227,4 +223,62 @@ public void validate() { pairedKey().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cryptoKeyId", this.cryptoKeyId); + jsonWriter.writeStringField("keyType", this.keyType); + jsonWriter.writeNumberField("keySize", this.keySize); + jsonWriter.writeStringField("keyAlgorithm", this.keyAlgorithm); + jsonWriter.writeArrayField("usage", this.usage, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("pairedKey", this.pairedKey); + jsonWriter.writeBooleanField("isShortKeySize", this.isShortKeySize); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CryptoKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CryptoKey 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 CryptoKey. + */ + public static CryptoKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CryptoKey deserializedCryptoKey = new CryptoKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cryptoKeyId".equals(fieldName)) { + deserializedCryptoKey.cryptoKeyId = reader.getString(); + } else if ("keyType".equals(fieldName)) { + deserializedCryptoKey.keyType = reader.getString(); + } else if ("keySize".equals(fieldName)) { + deserializedCryptoKey.keySize = reader.getNullable(JsonReader::getLong); + } else if ("keyAlgorithm".equals(fieldName)) { + deserializedCryptoKey.keyAlgorithm = reader.getString(); + } else if ("usage".equals(fieldName)) { + List usage = reader.readArray(reader1 -> reader1.getString()); + deserializedCryptoKey.usage = usage; + } else if ("filePaths".equals(fieldName)) { + List filePaths = reader.readArray(reader1 -> reader1.getString()); + deserializedCryptoKey.filePaths = filePaths; + } else if ("pairedKey".equals(fieldName)) { + deserializedCryptoKey.pairedKey = PairedKey.fromJson(reader); + } else if ("isShortKeySize".equals(fieldName)) { + deserializedCryptoKey.isShortKeySize = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedCryptoKey; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoKeyResourceInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoKeyResourceInner.java index 723308e310454..1350db6d1dd1a 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoKeyResourceInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CryptoKeyResourceInner.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.iotfirmwaredefense.models.PairedKey; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -19,15 +22,28 @@ public final class CryptoKeyResourceInner extends ProxyResource { /* * The properties of a crypto key found within a firmware image */ - @JsonProperty(value = "properties") private CryptoKey innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of CryptoKeyResourceInner class. */ @@ -52,6 +68,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the cryptoKeyId property: ID for the key result. * @@ -232,4 +278,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CryptoKeyResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CryptoKeyResourceInner 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 CryptoKeyResourceInner. + */ + public static CryptoKeyResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CryptoKeyResourceInner deserializedCryptoKeyResourceInner = new CryptoKeyResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCryptoKeyResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCryptoKeyResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCryptoKeyResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCryptoKeyResourceInner.innerProperties = CryptoKey.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCryptoKeyResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCryptoKeyResourceInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CveResourceInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CveResourceInner.java index a062d632d7d75..1a2c0e422cbd2 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CveResourceInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CveResourceInner.java @@ -7,9 +7,12 @@ 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.iotfirmwaredefense.models.CveComponent; import com.azure.resourcemanager.iotfirmwaredefense.models.CveLink; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -20,15 +23,28 @@ public final class CveResourceInner extends ProxyResource { /* * The properties of a CVE result found within a firmware image */ - @JsonProperty(value = "properties") private CveResult innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of CveResourceInner class. */ @@ -53,6 +69,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the cveId property: ID of the CVE result. * @@ -281,4 +327,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CveResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CveResourceInner 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 CveResourceInner. + */ + public static CveResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CveResourceInner deserializedCveResourceInner = new CveResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCveResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCveResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCveResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCveResourceInner.innerProperties = CveResult.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCveResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCveResourceInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CveResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CveResult.java index 65e29e3421a0d..b6ebb837b51a2 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CveResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/CveResult.java @@ -5,75 +5,69 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.models.CveComponent; import com.azure.resourcemanager.iotfirmwaredefense.models.CveLink; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Details of a CVE detected in firmware. */ @Fluent -public final class CveResult { +public final class CveResult implements JsonSerializable { /* * ID of the CVE result. */ - @JsonProperty(value = "cveId") private String cveId; /* * The SBOM component for the CVE. */ - @JsonProperty(value = "component") private CveComponent component; /* * Severity of the CVE. */ - @JsonProperty(value = "severity") private String severity; /* * Name of the CVE. */ - @JsonProperty(value = "name") private String name; /* - * A single CVSS score to represent the CVE. If a V3 score is specified, then it will use the V3 score. Otherwise - * if the V2 score is specified it will be the V2 score. + * A single CVSS score to represent the CVE. If a V3 score is specified, then it will use the V3 score. Otherwise if + * the V2 score is specified it will be the V2 score. */ - @JsonProperty(value = "cvssScore") private String cvssScore; /* * CVSS version of the CVE. */ - @JsonProperty(value = "cvssVersion") private String cvssVersion; /* * CVSS V2 score of the CVE. */ - @JsonProperty(value = "cvssV2Score") private String cvssV2Score; /* * CVSS V3 score of the CVE. */ - @JsonProperty(value = "cvssV3Score") private String cvssV3Score; /* * The list of reference links for the CVE. */ - @JsonProperty(value = "links", access = JsonProperty.Access.WRITE_ONLY) private List links; /* * The CVE description. */ - @JsonProperty(value = "description") private String description; /** @@ -286,4 +280,67 @@ public void validate() { links().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cveId", this.cveId); + jsonWriter.writeJsonField("component", this.component); + jsonWriter.writeStringField("severity", this.severity); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("cvssScore", this.cvssScore); + jsonWriter.writeStringField("cvssVersion", this.cvssVersion); + jsonWriter.writeStringField("cvssV2Score", this.cvssV2Score); + jsonWriter.writeStringField("cvssV3Score", this.cvssV3Score); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CveResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CveResult 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 CveResult. + */ + public static CveResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CveResult deserializedCveResult = new CveResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cveId".equals(fieldName)) { + deserializedCveResult.cveId = reader.getString(); + } else if ("component".equals(fieldName)) { + deserializedCveResult.component = CveComponent.fromJson(reader); + } else if ("severity".equals(fieldName)) { + deserializedCveResult.severity = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCveResult.name = reader.getString(); + } else if ("cvssScore".equals(fieldName)) { + deserializedCveResult.cvssScore = reader.getString(); + } else if ("cvssVersion".equals(fieldName)) { + deserializedCveResult.cvssVersion = reader.getString(); + } else if ("cvssV2Score".equals(fieldName)) { + deserializedCveResult.cvssV2Score = reader.getString(); + } else if ("cvssV3Score".equals(fieldName)) { + deserializedCveResult.cvssV3Score = reader.getString(); + } else if ("links".equals(fieldName)) { + List links = reader.readArray(reader1 -> CveLink.fromJson(reader1)); + deserializedCveResult.links = links; + } else if ("description".equals(fieldName)) { + deserializedCveResult.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCveResult; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/FirmwareInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/FirmwareInner.java index eea703ddf639a..9ab31e96046bf 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/FirmwareInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/FirmwareInner.java @@ -7,10 +7,13 @@ 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.iotfirmwaredefense.models.ProvisioningState; import com.azure.resourcemanager.iotfirmwaredefense.models.Status; import com.azure.resourcemanager.iotfirmwaredefense.models.StatusMessage; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -21,15 +24,28 @@ public final class FirmwareInner extends ProxyResource { /* * The properties of a firmware */ - @JsonProperty(value = "properties") private FirmwareProperties innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of FirmwareInner class. */ @@ -54,6 +70,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the fileName property: File name for a firmware that user uploaded. * @@ -257,4 +303,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirmwareInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirmwareInner 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 FirmwareInner. + */ + public static FirmwareInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirmwareInner deserializedFirmwareInner = new FirmwareInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFirmwareInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFirmwareInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFirmwareInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFirmwareInner.innerProperties = FirmwareProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFirmwareInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFirmwareInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/FirmwareProperties.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/FirmwareProperties.java index b063e7e44f0a9..63901ab26574d 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/FirmwareProperties.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/FirmwareProperties.java @@ -5,69 +5,64 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.models.ProvisioningState; import com.azure.resourcemanager.iotfirmwaredefense.models.Status; import com.azure.resourcemanager.iotfirmwaredefense.models.StatusMessage; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Firmware properties. */ @Fluent -public final class FirmwareProperties { +public final class FirmwareProperties implements JsonSerializable { /* * File name for a firmware that user uploaded. */ - @JsonProperty(value = "fileName") private String fileName; /* * Firmware vendor. */ - @JsonProperty(value = "vendor") private String vendor; /* * Firmware model. */ - @JsonProperty(value = "model") private String model; /* * Firmware version. */ - @JsonProperty(value = "version") private String version; /* * User-specified description of the firmware. */ - @JsonProperty(value = "description") private String description; /* * File size of the uploaded firmware image. */ - @JsonProperty(value = "fileSize") private Long fileSize; /* * The status of firmware scan. */ - @JsonProperty(value = "status") private Status status; /* * A list of errors or other messages generated during firmware analysis */ - @JsonProperty(value = "statusMessages") private List statusMessages; /* * Provisioning state of the resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -255,4 +250,65 @@ public void validate() { statusMessages().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fileName", this.fileName); + jsonWriter.writeStringField("vendor", this.vendor); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeNumberField("fileSize", this.fileSize); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeArrayField("statusMessages", this.statusMessages, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirmwareProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirmwareProperties 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 FirmwareProperties. + */ + public static FirmwareProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirmwareProperties deserializedFirmwareProperties = new FirmwareProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fileName".equals(fieldName)) { + deserializedFirmwareProperties.fileName = reader.getString(); + } else if ("vendor".equals(fieldName)) { + deserializedFirmwareProperties.vendor = reader.getString(); + } else if ("model".equals(fieldName)) { + deserializedFirmwareProperties.model = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedFirmwareProperties.version = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedFirmwareProperties.description = reader.getString(); + } else if ("fileSize".equals(fieldName)) { + deserializedFirmwareProperties.fileSize = reader.getNullable(JsonReader::getLong); + } else if ("status".equals(fieldName)) { + deserializedFirmwareProperties.status = Status.fromString(reader.getString()); + } else if ("statusMessages".equals(fieldName)) { + List statusMessages = reader.readArray(reader1 -> StatusMessage.fromJson(reader1)); + deserializedFirmwareProperties.statusMessages = statusMessages; + } else if ("provisioningState".equals(fieldName)) { + deserializedFirmwareProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedFirmwareProperties; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/OperationInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/OperationInner.java index 9e665e7a378de..b87debb8498ab 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/OperationInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/OperationInner.java @@ -5,10 +5,14 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.models.ActionType; import com.azure.resourcemanager.iotfirmwaredefense.models.OperationDisplay; import com.azure.resourcemanager.iotfirmwaredefense.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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/PasswordHash.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/PasswordHash.java index 64fb63f701bfb..ccceecc5cd638 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/PasswordHash.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/PasswordHash.java @@ -5,53 +5,50 @@ package com.azure.resourcemanager.iotfirmwaredefense.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Password hash properties. */ @Fluent -public final class PasswordHash { +public final class PasswordHash implements JsonSerializable { /* * ID for password hash */ - @JsonProperty(value = "passwordHashId") private String passwordHashId; /* * File path of the password hash */ - @JsonProperty(value = "filePath") private String filePath; /* * Salt of the password hash */ - @JsonProperty(value = "salt") private String salt; /* * Hash of the password */ - @JsonProperty(value = "hash") private String hash; /* * Context of password hash */ - @JsonProperty(value = "context") private String context; /* * User name of password hash */ - @JsonProperty(value = "username") private String username; /* * Algorithm of the password hash */ - @JsonProperty(value = "algorithm") private String algorithm; /** @@ -207,4 +204,58 @@ public PasswordHash withAlgorithm(String algorithm) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("passwordHashId", this.passwordHashId); + jsonWriter.writeStringField("filePath", this.filePath); + jsonWriter.writeStringField("salt", this.salt); + jsonWriter.writeStringField("hash", this.hash); + jsonWriter.writeStringField("context", this.context); + jsonWriter.writeStringField("username", this.username); + jsonWriter.writeStringField("algorithm", this.algorithm); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PasswordHash from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PasswordHash 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 PasswordHash. + */ + public static PasswordHash fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PasswordHash deserializedPasswordHash = new PasswordHash(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("passwordHashId".equals(fieldName)) { + deserializedPasswordHash.passwordHashId = reader.getString(); + } else if ("filePath".equals(fieldName)) { + deserializedPasswordHash.filePath = reader.getString(); + } else if ("salt".equals(fieldName)) { + deserializedPasswordHash.salt = reader.getString(); + } else if ("hash".equals(fieldName)) { + deserializedPasswordHash.hash = reader.getString(); + } else if ("context".equals(fieldName)) { + deserializedPasswordHash.context = reader.getString(); + } else if ("username".equals(fieldName)) { + deserializedPasswordHash.username = reader.getString(); + } else if ("algorithm".equals(fieldName)) { + deserializedPasswordHash.algorithm = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPasswordHash; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/PasswordHashResourceInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/PasswordHashResourceInner.java index 003fe8e9adb53..8d1a744ad30de 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/PasswordHashResourceInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/PasswordHashResourceInner.java @@ -7,7 +7,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Password hash resource. @@ -17,15 +20,28 @@ public final class PasswordHashResourceInner extends ProxyResource { /* * The properties of a password hash found within a firmware image */ - @JsonProperty(value = "properties") private PasswordHash innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of PasswordHashResourceInner class. */ @@ -50,6 +66,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the passwordHashId property: ID for password hash. * @@ -221,4 +267,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PasswordHashResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PasswordHashResourceInner 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 PasswordHashResourceInner. + */ + public static PasswordHashResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PasswordHashResourceInner deserializedPasswordHashResourceInner = new PasswordHashResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPasswordHashResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPasswordHashResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPasswordHashResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPasswordHashResourceInner.innerProperties = PasswordHash.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPasswordHashResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPasswordHashResourceInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SbomComponent.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SbomComponent.java index 46d4a5dee2d72..5e2132b8938ba 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SbomComponent.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SbomComponent.java @@ -5,42 +5,41 @@ package com.azure.resourcemanager.iotfirmwaredefense.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * SBOM component of a firmware. */ @Fluent -public final class SbomComponent { +public final class SbomComponent implements JsonSerializable { /* * ID for the component. */ - @JsonProperty(value = "componentId") private String componentId; /* * Name for the component. */ - @JsonProperty(value = "componentName") private String componentName; /* * Version for the component. */ - @JsonProperty(value = "version") private String version; /* * License for the component. */ - @JsonProperty(value = "license") private String license; /* * File paths related to the component. */ - @JsonProperty(value = "filePaths") private List filePaths; /** @@ -156,4 +155,53 @@ public SbomComponent withFilePaths(List filePaths) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("componentId", this.componentId); + jsonWriter.writeStringField("componentName", this.componentName); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("license", this.license); + jsonWriter.writeArrayField("filePaths", this.filePaths, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SbomComponent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SbomComponent 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 SbomComponent. + */ + public static SbomComponent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SbomComponent deserializedSbomComponent = new SbomComponent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("componentId".equals(fieldName)) { + deserializedSbomComponent.componentId = reader.getString(); + } else if ("componentName".equals(fieldName)) { + deserializedSbomComponent.componentName = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedSbomComponent.version = reader.getString(); + } else if ("license".equals(fieldName)) { + deserializedSbomComponent.license = reader.getString(); + } else if ("filePaths".equals(fieldName)) { + List filePaths = reader.readArray(reader1 -> reader1.getString()); + deserializedSbomComponent.filePaths = filePaths; + } else { + reader.skipChildren(); + } + } + + return deserializedSbomComponent; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SbomComponentResourceInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SbomComponentResourceInner.java index 7704186e4ce87..d2ff3889bfd66 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SbomComponentResourceInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SbomComponentResourceInner.java @@ -7,7 +7,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** @@ -18,15 +21,28 @@ public final class SbomComponentResourceInner extends ProxyResource { /* * The properties of an SBOM component found within a firmware image */ - @JsonProperty(value = "properties") private SbomComponent innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SbomComponentResourceInner class. */ @@ -51,6 +67,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the componentId property: ID for the component. * @@ -176,4 +222,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SbomComponentResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SbomComponentResourceInner 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 SbomComponentResourceInner. + */ + public static SbomComponentResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SbomComponentResourceInner deserializedSbomComponentResourceInner = new SbomComponentResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSbomComponentResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSbomComponentResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSbomComponentResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSbomComponentResourceInner.innerProperties = SbomComponent.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSbomComponentResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSbomComponentResourceInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SummaryResourceInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SummaryResourceInner.java index 7f7bfdda32081..75a2ca6c93d0f 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SummaryResourceInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/SummaryResourceInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.iotfirmwaredefense.models.SummaryResourceProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The object representing a firmware analysis summary resource. @@ -18,15 +21,28 @@ public final class SummaryResourceInner extends ProxyResource { /* * Properties of an analysis summary. */ - @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private SummaryResourceProperties 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 SummaryResourceInner class. */ @@ -51,6 +67,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -61,4 +107,48 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SummaryResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SummaryResourceInner 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 SummaryResourceInner. + */ + public static SummaryResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SummaryResourceInner deserializedSummaryResourceInner = new SummaryResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSummaryResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSummaryResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSummaryResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSummaryResourceInner.properties = SummaryResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSummaryResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSummaryResourceInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/UrlTokenInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/UrlTokenInner.java index 4aafb2c90a322..5300aeb9b5c48 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/UrlTokenInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/UrlTokenInner.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.iotfirmwaredefense.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; /** * Url data for creating or accessing a blob file. */ @Immutable -public final class UrlTokenInner { +public final class UrlTokenInner implements JsonSerializable { /* * SAS URL for creating or accessing a blob file. */ - @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) private String url; /** @@ -40,4 +43,39 @@ public String url() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UrlTokenInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UrlTokenInner 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 UrlTokenInner. + */ + public static UrlTokenInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UrlTokenInner deserializedUrlTokenInner = new UrlTokenInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("url".equals(fieldName)) { + deserializedUrlTokenInner.url = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUrlTokenInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/WorkspaceInner.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/WorkspaceInner.java index 0edab0172f15a..5420035e95145 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/WorkspaceInner.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/WorkspaceInner.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.iotfirmwaredefense.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -19,15 +22,28 @@ public final class WorkspaceInner extends Resource { /* * Workspace properties. */ - @JsonProperty(value = "properties") private WorkspaceProperties innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of WorkspaceInner class. */ @@ -52,6 +68,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -89,4 +135,56 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceInner 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 WorkspaceInner. + */ + public static WorkspaceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceInner deserializedWorkspaceInner = new WorkspaceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspaceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspaceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspaceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedWorkspaceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedWorkspaceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedWorkspaceInner.innerProperties = WorkspaceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedWorkspaceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceInner; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/WorkspaceProperties.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/WorkspaceProperties.java index 505cdbda358d1..4aa0f38655caa 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/WorkspaceProperties.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/fluent/models/WorkspaceProperties.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.iotfirmwaredefense.fluent.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.iotfirmwaredefense.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Workspace properties. */ @Immutable -public final class WorkspaceProperties { +public final class WorkspaceProperties implements JsonSerializable { /* * Provisioning state of the resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -41,4 +44,40 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceProperties 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 WorkspaceProperties. + */ + public static WorkspaceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceProperties deserializedWorkspaceProperties = new WorkspaceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedWorkspaceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceProperties; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/BinaryHardeningsClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/BinaryHardeningsClientImpl.java index d681358f1eb9f..73ba3ab466205 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/BinaryHardeningsClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/BinaryHardeningsClientImpl.java @@ -56,8 +56,8 @@ public final class BinaryHardeningsClientImpl implements BinaryHardeningsClient } /** - * The interface defining all the services for IoTFirmwareDefenseBinaryHardenings to be used by the proxy service - * to perform REST calls. + * The interface defining all the services for IoTFirmwareDefenseBinaryHardenings to be used by the proxy service to + * perform REST calls. */ @Host("{$host}") @ServiceInterface(name = "IoTFirmwareDefenseBi") @@ -242,9 +242,7 @@ public PagedIterable listByFirmware(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. @@ -271,9 +269,7 @@ private Mono> listByFirmwareNextSing /** * 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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CryptoCertificatesClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CryptoCertificatesClientImpl.java index 1471fa83acfae..d4164bc627ecc 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CryptoCertificatesClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CryptoCertificatesClientImpl.java @@ -240,9 +240,7 @@ public PagedIterable listByFirmware(String resou /** * 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. @@ -268,9 +266,7 @@ private Mono> listByFirmwareNextSi /** * 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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CryptoKeysClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CryptoKeysClientImpl.java index b9cf4dc2b54d9..45da586748196 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CryptoKeysClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CryptoKeysClientImpl.java @@ -240,9 +240,7 @@ public PagedIterable listByFirmware(String resourceGroup /** * 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. @@ -268,9 +266,7 @@ private Mono> listByFirmwareNextSinglePage /** * 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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CvesClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CvesClientImpl.java index b58d6f12227a7..19c25f5be8c56 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CvesClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/CvesClientImpl.java @@ -238,9 +238,7 @@ public PagedIterable listByFirmware(String resourceGroupName, /** * 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. @@ -266,9 +264,7 @@ private Mono> listByFirmwareNextSinglePageAsync( /** * 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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/FirmwaresClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/FirmwaresClientImpl.java index 80177869933ab..439e786284238 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/FirmwaresClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/FirmwaresClientImpl.java @@ -1109,9 +1109,7 @@ public UrlTokenInner generateFilesystemDownloadUrl(String resourceGroupName, Str /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1137,9 +1135,7 @@ private Mono> listByWorkspaceNextSinglePageAsync(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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/IoTFirmwareDefenseImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/IoTFirmwareDefenseImpl.java index 3d80b2ed75fee..008eeb96021b9 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/IoTFirmwareDefenseImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/IoTFirmwareDefenseImpl.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.iotfirmwaredefense.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; @@ -403,7 +404,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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/OperationsClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/OperationsClientImpl.java index cdeb210ecf183..757ff8f6c5386 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/OperationsClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/PasswordHashesClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/PasswordHashesClientImpl.java index a826d2f39aaae..2dd7b76669c05 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/PasswordHashesClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/PasswordHashesClientImpl.java @@ -240,9 +240,7 @@ public PagedIterable listByFirmware(String resourceGr /** * 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. @@ -268,9 +266,7 @@ private Mono> listByFirmwareNextSingleP /** * 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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/ResourceManagerUtils.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/ResourceManagerUtils.java index 791a676d80b31..11ea5a812f4c6 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/ResourceManagerUtils.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/SbomComponentsClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/SbomComponentsClientImpl.java index 10f28eedcfa7e..2ed48b4e49181 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/SbomComponentsClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/SbomComponentsClientImpl.java @@ -240,9 +240,7 @@ public PagedIterable listByFirmware(String resourceG /** * 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. @@ -268,9 +266,7 @@ private Mono> listByFirmwareNextSingle /** * 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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/SummariesClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/SummariesClientImpl.java index 4b4525cb41f39..89674c8a00769 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/SummariesClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/SummariesClientImpl.java @@ -396,9 +396,7 @@ public SummaryResourceInner get(String resourceGroupName, String workspaceName, /** * 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. @@ -424,9 +422,7 @@ private Mono> listByFirmwareNextSinglePageAs /** * 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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/WorkspacesClientImpl.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/WorkspacesClientImpl.java index b0ec189e1ba82..3ce6752ed165b 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/WorkspacesClientImpl.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/implementation/WorkspacesClientImpl.java @@ -1036,9 +1036,7 @@ public UrlTokenInner generateUploadUrl(String resourceGroupName, String workspac /** * 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. @@ -1066,9 +1064,7 @@ private Mono> listBySubscriptionNextSinglePageAsyn /** * 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. @@ -1096,9 +1092,7 @@ private Mono> listBySubscriptionNextSinglePageAsyn /** * 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. @@ -1126,9 +1120,7 @@ private Mono> listByResourceGroupNextSinglePageAsy /** * 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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/ActionType.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/ActionType.java index fa6342ff6b034..e0c612d9471e0 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/ActionType.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/ActionType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.iotfirmwaredefense.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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/BinaryHardeningListResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/BinaryHardeningListResult.java index f4060cffcb44f..99828d5ef0681 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/BinaryHardeningListResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/BinaryHardeningListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.BinaryHardeningResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of binary hardening results. */ @Fluent -public final class BinaryHardeningListResult { +public final class BinaryHardeningListResult implements JsonSerializable { /* * The list of binary hardening results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The uri to fetch the next page of resources. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BinaryHardeningListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BinaryHardeningListResult 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 BinaryHardeningListResult. + */ + public static BinaryHardeningListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryHardeningListResult deserializedBinaryHardeningListResult = new BinaryHardeningListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> BinaryHardeningResourceInner.fromJson(reader1)); + deserializedBinaryHardeningListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedBinaryHardeningListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBinaryHardeningListResult; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/BinaryHardeningSummaryResource.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/BinaryHardeningSummaryResource.java index 8c8cec0d54a67..2ec9ffe266440 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/BinaryHardeningSummaryResource.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/BinaryHardeningSummaryResource.java @@ -5,51 +5,49 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Properties for a binary hardening analysis summary. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "summaryType") -@JsonTypeName("BinaryHardening") @Fluent public final class BinaryHardeningSummaryResource extends SummaryResourceProperties { + /* + * Describes the type of summary. + */ + private SummaryType summaryType = SummaryType.BINARY_HARDENING; + /* * Total number of binaries that were analyzed */ - @JsonProperty(value = "totalFiles") private Long totalFiles; /* * NX summary percentage */ - @JsonProperty(value = "nx") private Integer nx; /* * PIE summary percentage */ - @JsonProperty(value = "pie") private Integer pie; /* * RELRO summary percentage */ - @JsonProperty(value = "relro") private Integer relro; /* * Canary summary percentage */ - @JsonProperty(value = "canary") private Integer canary; /* * Stripped summary percentage */ - @JsonProperty(value = "stripped") private Integer stripped; /** @@ -58,6 +56,16 @@ public final class BinaryHardeningSummaryResource extends SummaryResourcePropert public BinaryHardeningSummaryResource() { } + /** + * Get the summaryType property: Describes the type of summary. + * + * @return the summaryType value. + */ + @Override + public SummaryType summaryType() { + return this.summaryType; + } + /** * Get the totalFiles property: Total number of binaries that were analyzed. * @@ -185,6 +193,60 @@ public BinaryHardeningSummaryResource withStripped(Integer stripped) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("summaryType", this.summaryType == null ? null : this.summaryType.toString()); + jsonWriter.writeNumberField("totalFiles", this.totalFiles); + jsonWriter.writeNumberField("nx", this.nx); + jsonWriter.writeNumberField("pie", this.pie); + jsonWriter.writeNumberField("relro", this.relro); + jsonWriter.writeNumberField("canary", this.canary); + jsonWriter.writeNumberField("stripped", this.stripped); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BinaryHardeningSummaryResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BinaryHardeningSummaryResource 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 BinaryHardeningSummaryResource. + */ + public static BinaryHardeningSummaryResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryHardeningSummaryResource deserializedBinaryHardeningSummaryResource + = new BinaryHardeningSummaryResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("summaryType".equals(fieldName)) { + deserializedBinaryHardeningSummaryResource.summaryType = SummaryType.fromString(reader.getString()); + } else if ("totalFiles".equals(fieldName)) { + deserializedBinaryHardeningSummaryResource.totalFiles = reader.getNullable(JsonReader::getLong); + } else if ("nx".equals(fieldName)) { + deserializedBinaryHardeningSummaryResource.nx = reader.getNullable(JsonReader::getInt); + } else if ("pie".equals(fieldName)) { + deserializedBinaryHardeningSummaryResource.pie = reader.getNullable(JsonReader::getInt); + } else if ("relro".equals(fieldName)) { + deserializedBinaryHardeningSummaryResource.relro = reader.getNullable(JsonReader::getInt); + } else if ("canary".equals(fieldName)) { + deserializedBinaryHardeningSummaryResource.canary = reader.getNullable(JsonReader::getInt); + } else if ("stripped".equals(fieldName)) { + deserializedBinaryHardeningSummaryResource.stripped = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedBinaryHardeningSummaryResource; + }); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateEntity.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateEntity.java index 97b345391b684..6f48b347d6049 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateEntity.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateEntity.java @@ -5,41 +5,40 @@ package com.azure.resourcemanager.iotfirmwaredefense.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; /** * Information on an entity (distinguished name) in a cryptographic certificate. */ @Fluent -public final class CryptoCertificateEntity { +public final class CryptoCertificateEntity implements JsonSerializable { /* * Common name of the certificate entity. */ - @JsonProperty(value = "commonName") private String commonName; /* * Organization of the certificate entity. */ - @JsonProperty(value = "organization") private String organization; /* * The organizational unit of the certificate entity. */ - @JsonProperty(value = "organizationalUnit") private String organizationalUnit; /* * Geographical state or province of the certificate entity. */ - @JsonProperty(value = "state") private String state; /* * Country code of the certificate entity. */ - @JsonProperty(value = "country") private String country; /** @@ -155,4 +154,52 @@ public CryptoCertificateEntity withCountry(String country) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("commonName", this.commonName); + jsonWriter.writeStringField("organization", this.organization); + jsonWriter.writeStringField("organizationalUnit", this.organizationalUnit); + jsonWriter.writeStringField("state", this.state); + jsonWriter.writeStringField("country", this.country); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CryptoCertificateEntity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CryptoCertificateEntity 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 CryptoCertificateEntity. + */ + public static CryptoCertificateEntity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CryptoCertificateEntity deserializedCryptoCertificateEntity = new CryptoCertificateEntity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("commonName".equals(fieldName)) { + deserializedCryptoCertificateEntity.commonName = reader.getString(); + } else if ("organization".equals(fieldName)) { + deserializedCryptoCertificateEntity.organization = reader.getString(); + } else if ("organizationalUnit".equals(fieldName)) { + deserializedCryptoCertificateEntity.organizationalUnit = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedCryptoCertificateEntity.state = reader.getString(); + } else if ("country".equals(fieldName)) { + deserializedCryptoCertificateEntity.country = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCryptoCertificateEntity; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateListResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateListResult.java index 3ab0bd380485a..d575b2bdb3c95 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateListResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.CryptoCertificateResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of crypto certificates. */ @Fluent -public final class CryptoCertificateListResult { +public final class CryptoCertificateListResult implements JsonSerializable { /* * The list of crypto certificate results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The uri to fetch the next page of resources. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CryptoCertificateListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CryptoCertificateListResult 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 CryptoCertificateListResult. + */ + public static CryptoCertificateListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CryptoCertificateListResult deserializedCryptoCertificateListResult = new CryptoCertificateListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CryptoCertificateResourceInner.fromJson(reader1)); + deserializedCryptoCertificateListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCryptoCertificateListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCryptoCertificateListResult; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateSummaryResource.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateSummaryResource.java index c27eea0d3a3a2..9bf514658ec02 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateSummaryResource.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoCertificateSummaryResource.java @@ -5,57 +5,54 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Properties for cryptographic certificate summary. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "summaryType") -@JsonTypeName("CryptoCertificate") @Fluent public final class CryptoCertificateSummaryResource extends SummaryResourceProperties { + /* + * Describes the type of summary. + */ + private SummaryType summaryType = SummaryType.CRYPTO_CERTIFICATE; + /* * Total number of certificates found. */ - @JsonProperty(value = "totalCertificates") private Long totalCertificates; /* * Total number of paired private keys found for the certificates. */ - @JsonProperty(value = "pairedKeys") private Long pairedKeys; /* * Total number of expired certificates found. */ - @JsonProperty(value = "expired") private Long expired; /* * Total number of nearly expired certificates found. */ - @JsonProperty(value = "expiringSoon") private Long expiringSoon; /* * Total number of certificates found using a weak signature algorithm. */ - @JsonProperty(value = "weakSignature") private Long weakSignature; /* * Total number of certificates found that are self-signed. */ - @JsonProperty(value = "selfSigned") private Long selfSigned; /* * Total number of certificates found that have an insecure key size for the key algorithm. */ - @JsonProperty(value = "shortKeySize") private Long shortKeySize; /** @@ -64,6 +61,16 @@ public final class CryptoCertificateSummaryResource extends SummaryResourcePrope public CryptoCertificateSummaryResource() { } + /** + * Get the summaryType property: Describes the type of summary. + * + * @return the summaryType value. + */ + @Override + public SummaryType summaryType() { + return this.summaryType; + } + /** * Get the totalCertificates property: Total number of certificates found. * @@ -213,6 +220,66 @@ public CryptoCertificateSummaryResource withShortKeySize(Long shortKeySize) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("summaryType", this.summaryType == null ? null : this.summaryType.toString()); + jsonWriter.writeNumberField("totalCertificates", this.totalCertificates); + jsonWriter.writeNumberField("pairedKeys", this.pairedKeys); + jsonWriter.writeNumberField("expired", this.expired); + jsonWriter.writeNumberField("expiringSoon", this.expiringSoon); + jsonWriter.writeNumberField("weakSignature", this.weakSignature); + jsonWriter.writeNumberField("selfSigned", this.selfSigned); + jsonWriter.writeNumberField("shortKeySize", this.shortKeySize); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CryptoCertificateSummaryResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CryptoCertificateSummaryResource 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 CryptoCertificateSummaryResource. + */ + public static CryptoCertificateSummaryResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CryptoCertificateSummaryResource deserializedCryptoCertificateSummaryResource + = new CryptoCertificateSummaryResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("summaryType".equals(fieldName)) { + deserializedCryptoCertificateSummaryResource.summaryType + = SummaryType.fromString(reader.getString()); + } else if ("totalCertificates".equals(fieldName)) { + deserializedCryptoCertificateSummaryResource.totalCertificates + = reader.getNullable(JsonReader::getLong); + } else if ("pairedKeys".equals(fieldName)) { + deserializedCryptoCertificateSummaryResource.pairedKeys = reader.getNullable(JsonReader::getLong); + } else if ("expired".equals(fieldName)) { + deserializedCryptoCertificateSummaryResource.expired = reader.getNullable(JsonReader::getLong); + } else if ("expiringSoon".equals(fieldName)) { + deserializedCryptoCertificateSummaryResource.expiringSoon = reader.getNullable(JsonReader::getLong); + } else if ("weakSignature".equals(fieldName)) { + deserializedCryptoCertificateSummaryResource.weakSignature + = reader.getNullable(JsonReader::getLong); + } else if ("selfSigned".equals(fieldName)) { + deserializedCryptoCertificateSummaryResource.selfSigned = reader.getNullable(JsonReader::getLong); + } else if ("shortKeySize".equals(fieldName)) { + deserializedCryptoCertificateSummaryResource.shortKeySize = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedCryptoCertificateSummaryResource; + }); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoKeyListResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoKeyListResult.java index cd6656fde7f90..53e61511a6fef 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoKeyListResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoKeyListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.CryptoKeyResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of crypto keys. */ @Fluent -public final class CryptoKeyListResult { +public final class CryptoKeyListResult implements JsonSerializable { /* * The list of crypto key results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The uri to fetch the next page of resources. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CryptoKeyListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CryptoKeyListResult 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 CryptoKeyListResult. + */ + public static CryptoKeyListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CryptoKeyListResult deserializedCryptoKeyListResult = new CryptoKeyListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CryptoKeyResourceInner.fromJson(reader1)); + deserializedCryptoKeyListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCryptoKeyListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCryptoKeyListResult; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoKeySummaryResource.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoKeySummaryResource.java index 6a558ea9ff908..2411518d5554d 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoKeySummaryResource.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CryptoKeySummaryResource.java @@ -5,45 +5,44 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Properties for cryptographic key summary. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "summaryType") -@JsonTypeName("CryptoKey") @Fluent public final class CryptoKeySummaryResource extends SummaryResourceProperties { + /* + * Describes the type of summary. + */ + private SummaryType summaryType = SummaryType.CRYPTO_KEY; + /* * Total number of cryptographic keys found. */ - @JsonProperty(value = "totalKeys") private Long totalKeys; /* * Total number of (non-certificate) public keys found. */ - @JsonProperty(value = "publicKeys") private Long publicKeys; /* * Total number of private keys found. */ - @JsonProperty(value = "privateKeys") private Long privateKeys; /* * Total number of keys found that have a matching paired key or certificate. */ - @JsonProperty(value = "pairedKeys") private Long pairedKeys; /* * Total number of keys found that have an insecure key size for the algorithm. */ - @JsonProperty(value = "shortKeySize") private Long shortKeySize; /** @@ -52,6 +51,16 @@ public final class CryptoKeySummaryResource extends SummaryResourceProperties { public CryptoKeySummaryResource() { } + /** + * Get the summaryType property: Describes the type of summary. + * + * @return the summaryType value. + */ + @Override + public SummaryType summaryType() { + return this.summaryType; + } + /** * Get the totalKeys property: Total number of cryptographic keys found. * @@ -159,6 +168,56 @@ public CryptoKeySummaryResource withShortKeySize(Long shortKeySize) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("summaryType", this.summaryType == null ? null : this.summaryType.toString()); + jsonWriter.writeNumberField("totalKeys", this.totalKeys); + jsonWriter.writeNumberField("publicKeys", this.publicKeys); + jsonWriter.writeNumberField("privateKeys", this.privateKeys); + jsonWriter.writeNumberField("pairedKeys", this.pairedKeys); + jsonWriter.writeNumberField("shortKeySize", this.shortKeySize); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CryptoKeySummaryResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CryptoKeySummaryResource 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 CryptoKeySummaryResource. + */ + public static CryptoKeySummaryResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CryptoKeySummaryResource deserializedCryptoKeySummaryResource = new CryptoKeySummaryResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("summaryType".equals(fieldName)) { + deserializedCryptoKeySummaryResource.summaryType = SummaryType.fromString(reader.getString()); + } else if ("totalKeys".equals(fieldName)) { + deserializedCryptoKeySummaryResource.totalKeys = reader.getNullable(JsonReader::getLong); + } else if ("publicKeys".equals(fieldName)) { + deserializedCryptoKeySummaryResource.publicKeys = reader.getNullable(JsonReader::getLong); + } else if ("privateKeys".equals(fieldName)) { + deserializedCryptoKeySummaryResource.privateKeys = reader.getNullable(JsonReader::getLong); + } else if ("pairedKeys".equals(fieldName)) { + deserializedCryptoKeySummaryResource.pairedKeys = reader.getNullable(JsonReader::getLong); + } else if ("shortKeySize".equals(fieldName)) { + deserializedCryptoKeySummaryResource.shortKeySize = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedCryptoKeySummaryResource; + }); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveComponent.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveComponent.java index 78d7643b31128..9abce6e014a4a 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveComponent.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveComponent.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.iotfirmwaredefense.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; /** * Properties of the SBOM component for a CVE. */ @Fluent -public final class CveComponent { +public final class CveComponent implements JsonSerializable { /* * ID of the SBOM component */ - @JsonProperty(value = "componentId") private String componentId; /* * Name of the SBOM component */ - @JsonProperty(value = "name") private String name; /* * Version of the SBOM component. */ - @JsonProperty(value = "version") private String version; /** @@ -103,4 +104,46 @@ public CveComponent withVersion(String version) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("componentId", this.componentId); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CveComponent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CveComponent 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 CveComponent. + */ + public static CveComponent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CveComponent deserializedCveComponent = new CveComponent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("componentId".equals(fieldName)) { + deserializedCveComponent.componentId = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCveComponent.name = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedCveComponent.version = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCveComponent; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveLink.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveLink.java index bb851d0e37ec6..416af54cc6912 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveLink.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveLink.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.iotfirmwaredefense.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; /** * Properties of a reference link for a CVE. */ @Fluent -public final class CveLink { +public final class CveLink implements JsonSerializable { /* * The destination of the reference link. */ - @JsonProperty(value = "href") private String href; /* * The label of the reference link. */ - @JsonProperty(value = "label") private String label; /** @@ -77,4 +79,43 @@ public CveLink withLabel(String label) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("href", this.href); + jsonWriter.writeStringField("label", this.label); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CveLink from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CveLink 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 CveLink. + */ + public static CveLink fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CveLink deserializedCveLink = new CveLink(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("href".equals(fieldName)) { + deserializedCveLink.href = reader.getString(); + } else if ("label".equals(fieldName)) { + deserializedCveLink.label = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCveLink; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveListResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveListResult.java index 90c2817d91097..c63382bbb8519 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveListResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.CveResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of CVE results. */ @Fluent -public final class CveListResult { +public final class CveListResult implements JsonSerializable { /* * The list of CVE results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The uri to fetch the next page of resources. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +73,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CveListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CveListResult 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 CveListResult. + */ + public static CveListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CveListResult deserializedCveListResult = new CveListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> CveResourceInner.fromJson(reader1)); + deserializedCveListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCveListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCveListResult; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveSummary.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveSummary.java index e73a215b54063..3fadc5d682bcc 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveSummary.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/CveSummary.java @@ -5,45 +5,44 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Properties for a CVE analysis summary. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "summaryType") -@JsonTypeName("CVE") @Fluent public final class CveSummary extends SummaryResourceProperties { + /* + * Describes the type of summary. + */ + private SummaryType summaryType = SummaryType.CVE; + /* * The total number of critical severity CVEs detected */ - @JsonProperty(value = "critical") private Long critical; /* * The total number of high severity CVEs detected */ - @JsonProperty(value = "high") private Long high; /* * The total number of medium severity CVEs detected */ - @JsonProperty(value = "medium") private Long medium; /* * The total number of low severity CVEs detected */ - @JsonProperty(value = "low") private Long low; /* * The total number of unknown severity CVEs detected */ - @JsonProperty(value = "unknown") private Long unknown; /** @@ -52,6 +51,16 @@ public final class CveSummary extends SummaryResourceProperties { public CveSummary() { } + /** + * Get the summaryType property: Describes the type of summary. + * + * @return the summaryType value. + */ + @Override + public SummaryType summaryType() { + return this.summaryType; + } + /** * Get the critical property: The total number of critical severity CVEs detected. * @@ -159,6 +168,56 @@ public CveSummary withUnknown(Long unknown) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("summaryType", this.summaryType == null ? null : this.summaryType.toString()); + jsonWriter.writeNumberField("critical", this.critical); + jsonWriter.writeNumberField("high", this.high); + jsonWriter.writeNumberField("medium", this.medium); + jsonWriter.writeNumberField("low", this.low); + jsonWriter.writeNumberField("unknown", this.unknown); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CveSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CveSummary 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 CveSummary. + */ + public static CveSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CveSummary deserializedCveSummary = new CveSummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("summaryType".equals(fieldName)) { + deserializedCveSummary.summaryType = SummaryType.fromString(reader.getString()); + } else if ("critical".equals(fieldName)) { + deserializedCveSummary.critical = reader.getNullable(JsonReader::getLong); + } else if ("high".equals(fieldName)) { + deserializedCveSummary.high = reader.getNullable(JsonReader::getLong); + } else if ("medium".equals(fieldName)) { + deserializedCveSummary.medium = reader.getNullable(JsonReader::getLong); + } else if ("low".equals(fieldName)) { + deserializedCveSummary.low = reader.getNullable(JsonReader::getLong); + } else if ("unknown".equals(fieldName)) { + deserializedCveSummary.unknown = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedCveSummary; + }); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareList.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareList.java index 00617e6002cdd..b778591b051a8 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareList.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.FirmwareInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of firmwares. */ @Fluent -public final class FirmwareList { +public final class FirmwareList implements JsonSerializable { /* * The list of firmwares. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The uri to fetch the next page of asset. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +73,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirmwareList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirmwareList 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 FirmwareList. + */ + public static FirmwareList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirmwareList deserializedFirmwareList = new FirmwareList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> FirmwareInner.fromJson(reader1)); + deserializedFirmwareList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFirmwareList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFirmwareList; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareSummary.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareSummary.java index 7a6c0208f8c09..249a85c916baa 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareSummary.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareSummary.java @@ -5,57 +5,54 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Properties for high level summary of firmware analysis results. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "summaryType") -@JsonTypeName("Firmware") @Fluent public final class FirmwareSummary extends SummaryResourceProperties { + /* + * Describes the type of summary. + */ + private SummaryType summaryType = SummaryType.FIRMWARE; + /* * Total extracted size of the firmware in bytes. */ - @JsonProperty(value = "extractedSize") private Long extractedSize; /* * Firmware file size in bytes. */ - @JsonProperty(value = "fileSize") private Long fileSize; /* * Extracted file count. */ - @JsonProperty(value = "extractedFileCount") private Long extractedFileCount; /* * Components count. */ - @JsonProperty(value = "componentCount") private Long componentCount; /* * Binary count */ - @JsonProperty(value = "binaryCount") private Long binaryCount; /* * Time used for analysis */ - @JsonProperty(value = "analysisTimeSeconds") private Long analysisTimeSeconds; /* * The number of root file systems found. */ - @JsonProperty(value = "rootFileSystems") private Long rootFileSystems; /** @@ -64,6 +61,16 @@ public final class FirmwareSummary extends SummaryResourceProperties { public FirmwareSummary() { } + /** + * Get the summaryType property: Describes the type of summary. + * + * @return the summaryType value. + */ + @Override + public SummaryType summaryType() { + return this.summaryType; + } + /** * Get the extractedSize property: Total extracted size of the firmware in bytes. * @@ -211,6 +218,62 @@ public FirmwareSummary withRootFileSystems(Long rootFileSystems) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("summaryType", this.summaryType == null ? null : this.summaryType.toString()); + jsonWriter.writeNumberField("extractedSize", this.extractedSize); + jsonWriter.writeNumberField("fileSize", this.fileSize); + jsonWriter.writeNumberField("extractedFileCount", this.extractedFileCount); + jsonWriter.writeNumberField("componentCount", this.componentCount); + jsonWriter.writeNumberField("binaryCount", this.binaryCount); + jsonWriter.writeNumberField("analysisTimeSeconds", this.analysisTimeSeconds); + jsonWriter.writeNumberField("rootFileSystems", this.rootFileSystems); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirmwareSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirmwareSummary 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 FirmwareSummary. + */ + public static FirmwareSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirmwareSummary deserializedFirmwareSummary = new FirmwareSummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("summaryType".equals(fieldName)) { + deserializedFirmwareSummary.summaryType = SummaryType.fromString(reader.getString()); + } else if ("extractedSize".equals(fieldName)) { + deserializedFirmwareSummary.extractedSize = reader.getNullable(JsonReader::getLong); + } else if ("fileSize".equals(fieldName)) { + deserializedFirmwareSummary.fileSize = reader.getNullable(JsonReader::getLong); + } else if ("extractedFileCount".equals(fieldName)) { + deserializedFirmwareSummary.extractedFileCount = reader.getNullable(JsonReader::getLong); + } else if ("componentCount".equals(fieldName)) { + deserializedFirmwareSummary.componentCount = reader.getNullable(JsonReader::getLong); + } else if ("binaryCount".equals(fieldName)) { + deserializedFirmwareSummary.binaryCount = reader.getNullable(JsonReader::getLong); + } else if ("analysisTimeSeconds".equals(fieldName)) { + deserializedFirmwareSummary.analysisTimeSeconds = reader.getNullable(JsonReader::getLong); + } else if ("rootFileSystems".equals(fieldName)) { + deserializedFirmwareSummary.rootFileSystems = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedFirmwareSummary; + }); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareUpdateDefinition.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareUpdateDefinition.java index 6eb4015d2c16d..8de3923ae4a44 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareUpdateDefinition.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/FirmwareUpdateDefinition.java @@ -5,19 +5,22 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.FirmwareProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Firmware definition. */ @Fluent -public final class FirmwareUpdateDefinition { +public final class FirmwareUpdateDefinition implements JsonSerializable { /* * The editable properties of a firmware */ - @JsonProperty(value = "properties") private FirmwareProperties innerProperties; /** @@ -238,4 +241,40 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirmwareUpdateDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirmwareUpdateDefinition 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 FirmwareUpdateDefinition. + */ + public static FirmwareUpdateDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirmwareUpdateDefinition deserializedFirmwareUpdateDefinition = new FirmwareUpdateDefinition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedFirmwareUpdateDefinition.innerProperties = FirmwareProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFirmwareUpdateDefinition; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/GenerateUploadUrlRequest.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/GenerateUploadUrlRequest.java index bdcfd6a4d151b..7753906b3af0f 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/GenerateUploadUrlRequest.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/GenerateUploadUrlRequest.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.iotfirmwaredefense.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; /** * Properties for generating an upload URL. */ @Fluent -public final class GenerateUploadUrlRequest { +public final class GenerateUploadUrlRequest implements JsonSerializable { /* * A unique ID for the firmware to be uploaded. */ - @JsonProperty(value = "firmwareId") private String firmwareId; /** @@ -51,4 +54,40 @@ public GenerateUploadUrlRequest withFirmwareId(String firmwareId) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("firmwareId", this.firmwareId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenerateUploadUrlRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenerateUploadUrlRequest 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 GenerateUploadUrlRequest. + */ + public static GenerateUploadUrlRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GenerateUploadUrlRequest deserializedGenerateUploadUrlRequest = new GenerateUploadUrlRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("firmwareId".equals(fieldName)) { + deserializedGenerateUploadUrlRequest.firmwareId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGenerateUploadUrlRequest; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/OperationDisplay.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/OperationDisplay.java index ac4d6d0797883..d1b9be8eab14e 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/OperationDisplay.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/OperationDisplay.java @@ -5,38 +5,38 @@ package com.azure.resourcemanager.iotfirmwaredefense.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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/OperationListResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/OperationListResult.java index 594bf6c944685..9930e91b987bc 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/OperationListResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/OperationListResult.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/Origin.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/Origin.java index b2737993d57bb..06cf9b30ef075 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/Origin.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/Origin.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.iotfirmwaredefense.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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/PairedKey.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/PairedKey.java index 8c578015d2a3f..a63092b86d4e4 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/PairedKey.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/PairedKey.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.iotfirmwaredefense.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; /** * Details of a matching paired key or certificate. */ @Fluent -public final class PairedKey { +public final class PairedKey implements JsonSerializable { /* * ID of the paired key or certificate. */ - @JsonProperty(value = "id") private String id; /* * The type indicating whether the paired object is a key or certificate. */ - @JsonProperty(value = "type") private String type; /** @@ -77,4 +79,43 @@ public PairedKey withType(String type) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PairedKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PairedKey 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 PairedKey. + */ + public static PairedKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PairedKey deserializedPairedKey = new PairedKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPairedKey.id = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPairedKey.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPairedKey; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/PasswordHashListResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/PasswordHashListResult.java index 1630c7323f419..7aa7823c9c11e 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/PasswordHashListResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/PasswordHashListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.PasswordHashResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of password hash results. */ @Fluent -public final class PasswordHashListResult { +public final class PasswordHashListResult implements JsonSerializable { /* * The list of password hash results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The uri to fetch the next page of resources. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PasswordHashListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PasswordHashListResult 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 PasswordHashListResult. + */ + public static PasswordHashListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PasswordHashListResult deserializedPasswordHashListResult = new PasswordHashListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PasswordHashResourceInner.fromJson(reader1)); + deserializedPasswordHashListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPasswordHashListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPasswordHashListResult; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/ProvisioningState.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/ProvisioningState.java index 2352f14898812..0211f68662031 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/ProvisioningState.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/ProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,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/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SbomComponentListResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SbomComponentListResult.java index 3da5ea803f773..401fa377d9404 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SbomComponentListResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SbomComponentListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.SbomComponentResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of SBOM results. */ @Fluent -public final class SbomComponentListResult { +public final class SbomComponentListResult implements JsonSerializable { /* * The list of SBOM components. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The uri to fetch the next page of resources. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SbomComponentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SbomComponentListResult 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 SbomComponentListResult. + */ + public static SbomComponentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SbomComponentListResult deserializedSbomComponentListResult = new SbomComponentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SbomComponentResourceInner.fromJson(reader1)); + deserializedSbomComponentListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSbomComponentListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSbomComponentListResult; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/Status.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/Status.java index 8ac35b1a5ddb6..6f8f466705601 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/Status.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/Status.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public Status() { * @param name a name to look for. * @return the corresponding Status. */ - @JsonCreator public static Status fromString(String name) { return fromString(name, Status.class); } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/StatusMessage.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/StatusMessage.java index e94fac77c0a7e..350a351a28745 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/StatusMessage.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/StatusMessage.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.iotfirmwaredefense.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; /** * Error and status message. */ @Fluent -public final class StatusMessage { +public final class StatusMessage implements JsonSerializable { /* * The error code */ - @JsonProperty(value = "errorCode") private Long errorCode; /* * The error or status message */ - @JsonProperty(value = "message") private String message; /** @@ -77,4 +79,43 @@ public StatusMessage withMessage(String message) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("errorCode", this.errorCode); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StatusMessage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StatusMessage 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 StatusMessage. + */ + public static StatusMessage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StatusMessage deserializedStatusMessage = new StatusMessage(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedStatusMessage.errorCode = reader.getNullable(JsonReader::getLong); + } else if ("message".equals(fieldName)) { + deserializedStatusMessage.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStatusMessage; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryListResult.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryListResult.java index 0cff22b0e120c..cd62d12b5a0b7 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryListResult.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.SummaryResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of analysis summaries. */ @Fluent -public final class SummaryListResult { +public final class SummaryListResult implements JsonSerializable { /* * The list of summaries. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The uri to fetch the next page of resources. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SummaryListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SummaryListResult 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 SummaryListResult. + */ + public static SummaryListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SummaryListResult deserializedSummaryListResult = new SummaryListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SummaryResourceInner.fromJson(reader1)); + deserializedSummaryListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSummaryListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSummaryListResult; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryName.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryName.java index 8357178f0e4d5..d191223160c57 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryName.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryName.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public SummaryName() { * @param name a name to look for. * @return the corresponding SummaryName. */ - @JsonCreator public static SummaryName fromString(String name) { return fromString(name, SummaryName.class); } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryResourceProperties.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryResourceProperties.java index 678a5fb697354..b2df4c78d4017 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryResourceProperties.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryResourceProperties.java @@ -5,33 +5,37 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Properties of an analysis summary. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "summaryType", - defaultImpl = SummaryResourceProperties.class) -@JsonTypeName("SummaryResourceProperties") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "Firmware", value = FirmwareSummary.class), - @JsonSubTypes.Type(name = "CVE", value = CveSummary.class), - @JsonSubTypes.Type(name = "BinaryHardening", value = BinaryHardeningSummaryResource.class), - @JsonSubTypes.Type(name = "CryptoCertificate", value = CryptoCertificateSummaryResource.class), - @JsonSubTypes.Type(name = "CryptoKey", value = CryptoKeySummaryResource.class) }) @Immutable -public class SummaryResourceProperties { +public class SummaryResourceProperties implements JsonSerializable { + /* + * Describes the type of summary. + */ + private SummaryType summaryType = SummaryType.fromString("SummaryResourceProperties"); + /** * Creates an instance of SummaryResourceProperties class. */ public SummaryResourceProperties() { } + /** + * Get the summaryType property: Describes the type of summary. + * + * @return the summaryType value. + */ + public SummaryType summaryType() { + return this.summaryType; + } + /** * Validates the instance. * @@ -39,4 +43,73 @@ public SummaryResourceProperties() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("summaryType", this.summaryType == null ? null : this.summaryType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SummaryResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SummaryResourceProperties 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 SummaryResourceProperties. + */ + public static SummaryResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("summaryType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Firmware".equals(discriminatorValue)) { + return FirmwareSummary.fromJson(readerToUse.reset()); + } else if ("CVE".equals(discriminatorValue)) { + return CveSummary.fromJson(readerToUse.reset()); + } else if ("BinaryHardening".equals(discriminatorValue)) { + return BinaryHardeningSummaryResource.fromJson(readerToUse.reset()); + } else if ("CryptoCertificate".equals(discriminatorValue)) { + return CryptoCertificateSummaryResource.fromJson(readerToUse.reset()); + } else if ("CryptoKey".equals(discriminatorValue)) { + return CryptoKeySummaryResource.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static SummaryResourceProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SummaryResourceProperties deserializedSummaryResourceProperties = new SummaryResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("summaryType".equals(fieldName)) { + deserializedSummaryResourceProperties.summaryType = SummaryType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSummaryResourceProperties; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryType.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryType.java index fc1daadefba34..799ba9fb2c270 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryType.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/SummaryType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.iotfirmwaredefense.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public SummaryType() { * @param name a name to look for. * @return the corresponding SummaryType. */ - @JsonCreator public static SummaryType fromString(String name) { return fromString(name, SummaryType.class); } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/WorkspaceList.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/WorkspaceList.java index cefa79a509f29..92642029ef0a5 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/WorkspaceList.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/WorkspaceList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.WorkspaceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Return a list of firmware analysis workspaces. */ @Fluent -public final class WorkspaceList { +public final class WorkspaceList implements JsonSerializable { /* * The list of firmware analysis workspaces. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The uri to fetch the next page of asset. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +73,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceList 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 WorkspaceList. + */ + public static WorkspaceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceList deserializedWorkspaceList = new WorkspaceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> WorkspaceInner.fromJson(reader1)); + deserializedWorkspaceList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkspaceList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceList; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/WorkspaceUpdateDefinition.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/WorkspaceUpdateDefinition.java index 7d021ea923fd4..69de554e0093f 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/WorkspaceUpdateDefinition.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/com/azure/resourcemanager/iotfirmwaredefense/models/WorkspaceUpdateDefinition.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.iotfirmwaredefense.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.iotfirmwaredefense.fluent.models.WorkspaceProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Firmware analysis workspace. */ @Immutable -public final class WorkspaceUpdateDefinition { +public final class WorkspaceUpdateDefinition implements JsonSerializable { /* * The editable workspace properties. */ - @JsonProperty(value = "properties") private WorkspaceProperties innerProperties; /** @@ -53,4 +56,40 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceUpdateDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceUpdateDefinition 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 WorkspaceUpdateDefinition. + */ + public static WorkspaceUpdateDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceUpdateDefinition deserializedWorkspaceUpdateDefinition = new WorkspaceUpdateDefinition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedWorkspaceUpdateDefinition.innerProperties = WorkspaceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceUpdateDefinition; + }); + } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/module-info.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/module-info.java index 9692c083df74d..218dfebd546a1 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/module-info.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/java/module-info.java @@ -10,6 +10,6 @@ exports com.azure.resourcemanager.iotfirmwaredefense.fluent.models; exports com.azure.resourcemanager.iotfirmwaredefense.models; - opens com.azure.resourcemanager.iotfirmwaredefense.fluent.models to com.azure.core, com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.iotfirmwaredefense.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.iotfirmwaredefense.fluent.models to com.azure.core; + opens com.azure.resourcemanager.iotfirmwaredefense.models to com.azure.core; } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-iotfirmwaredefense/proxy-config.json b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-iotfirmwaredefense/proxy-config.json index 18ede4d0367b3..667a507e33210 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-iotfirmwaredefense/proxy-config.json +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-iotfirmwaredefense/proxy-config.json @@ -1 +1 @@ -[ [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.BinaryHardeningsClientImpl$BinaryHardeningsService" ], [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.CryptoCertificatesClientImpl$CryptoCertificatesService" ], [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.CryptoKeysClientImpl$CryptoKeysService" ], [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.CvesClientImpl$CvesService" ], [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.FirmwaresClientImpl$FirmwaresService" ], [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.PasswordHashesClientImpl$PasswordHashesService" ], [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.SbomComponentsClientImpl$SbomComponentsService" ], [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.SummariesClientImpl$SummariesService" ], [ "com.azure.resourcemanager.iotfirmwaredefense.implementation.WorkspacesClientImpl$WorkspacesService" ] ] \ No newline at end of file +[["com.azure.resourcemanager.iotfirmwaredefense.implementation.BinaryHardeningsClientImpl$BinaryHardeningsService"],["com.azure.resourcemanager.iotfirmwaredefense.implementation.CryptoCertificatesClientImpl$CryptoCertificatesService"],["com.azure.resourcemanager.iotfirmwaredefense.implementation.CryptoKeysClientImpl$CryptoKeysService"],["com.azure.resourcemanager.iotfirmwaredefense.implementation.CvesClientImpl$CvesService"],["com.azure.resourcemanager.iotfirmwaredefense.implementation.FirmwaresClientImpl$FirmwaresService"],["com.azure.resourcemanager.iotfirmwaredefense.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.iotfirmwaredefense.implementation.PasswordHashesClientImpl$PasswordHashesService"],["com.azure.resourcemanager.iotfirmwaredefense.implementation.SbomComponentsClientImpl$SbomComponentsService"],["com.azure.resourcemanager.iotfirmwaredefense.implementation.SummariesClientImpl$SummariesService"],["com.azure.resourcemanager.iotfirmwaredefense.implementation.WorkspacesClientImpl$WorkspacesService"]] \ No newline at end of file diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-iotfirmwaredefense/reflect-config.json b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-iotfirmwaredefense/reflect-config.json index b5bbd45f95a28..0637a088a01e8 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-iotfirmwaredefense/reflect-config.json +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-iotfirmwaredefense/reflect-config.json @@ -1,256 +1 @@ -[ { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.BinaryHardeningListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.BinaryHardeningResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.BinaryHardeningResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.BinaryHardeningFeatures", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.CryptoCertificateListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.CryptoCertificateResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.CryptoCertificate", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.CryptoCertificateEntity", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.PairedKey", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.CryptoKeyListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.CryptoKeyResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.CryptoKey", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.CveListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.CveResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.CveResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.CveComponent", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.CveLink", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.FirmwareList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.FirmwareInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.FirmwareProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.StatusMessage", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.FirmwareUpdateDefinition", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.UrlTokenInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.OperationListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.OperationInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.OperationDisplay", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.PasswordHashListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.PasswordHashResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.PasswordHash", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.SbomComponentListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.SbomComponentResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.SbomComponent", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.SummaryListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.SummaryResourceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.SummaryResourceProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.WorkspaceList", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.WorkspaceInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.fluent.models.WorkspaceProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.WorkspaceUpdateDefinition", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.GenerateUploadUrlRequest", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.FirmwareSummary", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.CveSummary", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.BinaryHardeningSummaryResource", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.CryptoCertificateSummaryResource", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.CryptoKeySummaryResource", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.Status", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.ProvisioningState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.Origin", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.ActionType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.SummaryType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.iotfirmwaredefense.models.SummaryName", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -} ] \ No newline at end of file +[] \ No newline at end of file diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/BinaryHardeningListByFirmwareSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/BinaryHardeningListByFirmwareSamples.java index 0048470863a7f..be271c578fea3 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/BinaryHardeningListByFirmwareSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/BinaryHardeningListByFirmwareSamples.java @@ -19,8 +19,9 @@ public final class BinaryHardeningListByFirmwareSamples { */ public static void binaryHardeningListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.binaryHardenings().listByFirmware("FirmwareAnalysisRG", "default", - "109a9886-50bf-85a8-9d75-000000000000", com.azure.core.util.Context.NONE); + manager.binaryHardenings() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -34,7 +35,8 @@ public static void binaryHardeningListByFirmwareMinimumSetGen( */ public static void binaryHardeningListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.binaryHardenings().listByFirmware("FirmwareAnalysisRG", "default", - "109a9886-50bf-85a8-9d75-000000000000", com.azure.core.util.Context.NONE); + manager.binaryHardenings() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CryptoCertificatesListByFirmwareSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CryptoCertificatesListByFirmwareSamples.java index 30ebad1861044..a4ee00e3db762 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CryptoCertificatesListByFirmwareSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CryptoCertificatesListByFirmwareSamples.java @@ -19,8 +19,9 @@ public final class CryptoCertificatesListByFirmwareSamples { */ public static void cryptoCertificatesListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cryptoCertificates().listByFirmware("FirmwareAnalysisRG", "default", - "109a9886-50bf-85a8-9d75-000000000000", com.azure.core.util.Context.NONE); + manager.cryptoCertificates() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -34,7 +35,8 @@ public static void cryptoCertificatesListByFirmwareMaximumSetGen( */ public static void cryptoCertificatesListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cryptoCertificates().listByFirmware("FirmwareAnalysisRG", "default", - "109a9886-50bf-85a8-9d75-000000000000", com.azure.core.util.Context.NONE); + manager.cryptoCertificates() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CryptoKeysListByFirmwareSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CryptoKeysListByFirmwareSamples.java index 24b31df3d1f42..ea81a1bc046f6 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CryptoKeysListByFirmwareSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CryptoKeysListByFirmwareSamples.java @@ -19,8 +19,9 @@ public final class CryptoKeysListByFirmwareSamples { */ public static void cryptoKeysListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cryptoKeys().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.cryptoKeys() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -34,7 +35,8 @@ public static void cryptoKeysListByFirmwareMinimumSetGen( */ public static void cryptoKeysListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cryptoKeys().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.cryptoKeys() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CvesListByFirmwareSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CvesListByFirmwareSamples.java index 88c909fc21bb2..7174d55a13cd1 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CvesListByFirmwareSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CvesListByFirmwareSamples.java @@ -19,8 +19,9 @@ public final class CvesListByFirmwareSamples { */ public static void cvesListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cves().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.cves() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -34,7 +35,8 @@ public static void cvesListByFirmwareMaximumSetGen( */ public static void cvesListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.cves().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.cves() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresCreateSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresCreateSamples.java index 6e4d7434616ad..b19251fb7aad2 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresCreateSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresCreateSamples.java @@ -23,10 +23,18 @@ public final class FirmwaresCreateSamples { */ public static void firmwaresCreateMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().define("umrkdttp").withExistingWorkspace("rgworkspaces-firmwares", "A7") - .withFileName("wresexxulcdsdd").withVendor("vycmdhgtmepcptyoubztiuudpkcpd").withModel("f").withVersion("s") - .withDescription("uz").withFileSize(17L).withStatus(Status.PENDING) - .withStatusMessages(Arrays.asList(new StatusMessage().withMessage("ulvhmhokezathzzauiitu"))).create(); + manager.firmwares() + .define("umrkdttp") + .withExistingWorkspace("rgworkspaces-firmwares", "A7") + .withFileName("wresexxulcdsdd") + .withVendor("vycmdhgtmepcptyoubztiuudpkcpd") + .withModel("f") + .withVersion("s") + .withDescription("uz") + .withFileSize(17L) + .withStatus(Status.PENDING) + .withStatusMessages(Arrays.asList(new StatusMessage().withMessage("ulvhmhokezathzzauiitu"))) + .create(); } /* diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresDeleteSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresDeleteSamples.java index dc3b28777b04d..c91cb020bb619 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresDeleteSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresDeleteSamples.java @@ -19,8 +19,8 @@ public final class FirmwaresDeleteSamples { */ public static void firmwaresDeleteMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().deleteWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .deleteWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE); } /* @@ -34,7 +34,7 @@ public final class FirmwaresDeleteSamples { */ public static void firmwaresDeleteMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().deleteWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .deleteWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateDownloadUrlSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateDownloadUrlSamples.java index 0aa7d926d898b..9a6b10d42880b 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateDownloadUrlSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateDownloadUrlSamples.java @@ -19,8 +19,9 @@ public final class FirmwaresGenerateDownloadUrlSamples { */ public static void firmwaresGenerateDownloadUrlMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().generateDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .generateDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", + com.azure.core.util.Context.NONE); } /* @@ -34,7 +35,8 @@ public static void firmwaresGenerateDownloadUrlMaximumSetGen( */ public static void firmwaresGenerateDownloadUrlMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().generateDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .generateDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateFilesystemDownloadUrlSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateFilesystemDownloadUrlSamples.java index 7f5cb01b37609..35faeca94839f 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateFilesystemDownloadUrlSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateFilesystemDownloadUrlSamples.java @@ -19,8 +19,9 @@ public final class FirmwaresGenerateFilesystemDownloadUrlSamples { */ public static void firmwaresGenerateFilesystemDownloadUrlMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().generateFilesystemDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .generateFilesystemDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", + com.azure.core.util.Context.NONE); } /* @@ -34,7 +35,8 @@ public static void firmwaresGenerateFilesystemDownloadUrlMaximumSetGen( */ public static void firmwaresGenerateFilesystemDownloadUrlMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().generateFilesystemDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .generateFilesystemDownloadUrlWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGetSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGetSamples.java index 0eaa1e2ee2510..6a060e714382d 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGetSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGetSamples.java @@ -19,8 +19,8 @@ public final class FirmwaresGetSamples { */ public static void firmwaresGetMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE); } /* @@ -34,7 +34,7 @@ public final class FirmwaresGetSamples { */ public static void firmwaresGetMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.firmwares().getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", - com.azure.core.util.Context.NONE); + manager.firmwares() + .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresUpdateSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresUpdateSamples.java index 1b9e31910bf82..e874f0259df1f 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresUpdateSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresUpdateSamples.java @@ -25,10 +25,18 @@ public final class FirmwaresUpdateSamples { public static void firmwaresUpdateMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { Firmware resource = manager.firmwares() - .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE).getValue(); - resource.update().withFileName("wresexxulcdsdd").withVendor("vycmdhgtmepcptyoubztiuudpkcpd").withModel("f") - .withVersion("s").withDescription("uz").withFileSize(17L).withStatus(Status.PENDING) - .withStatusMessages(Arrays.asList(new StatusMessage().withMessage("ulvhmhokezathzzauiitu"))).apply(); + .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withFileName("wresexxulcdsdd") + .withVendor("vycmdhgtmepcptyoubztiuudpkcpd") + .withModel("f") + .withVersion("s") + .withDescription("uz") + .withFileSize(17L) + .withStatus(Status.PENDING) + .withStatusMessages(Arrays.asList(new StatusMessage().withMessage("ulvhmhokezathzzauiitu"))) + .apply(); } /* @@ -43,7 +51,8 @@ public final class FirmwaresUpdateSamples { public static void firmwaresUpdateMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { Firmware resource = manager.firmwares() - .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE).getValue(); + .getWithResponse("rgworkspaces-firmwares", "A7", "umrkdttp", com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/PasswordHashesListByFirmwareSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/PasswordHashesListByFirmwareSamples.java index 387faa2b4674e..0f48eab3046f3 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/PasswordHashesListByFirmwareSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/PasswordHashesListByFirmwareSamples.java @@ -19,8 +19,9 @@ public final class PasswordHashesListByFirmwareSamples { */ public static void passwordHashesListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.passwordHashes().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.passwordHashes() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -34,7 +35,8 @@ public static void passwordHashesListByFirmwareMaximumSetGen( */ public static void passwordHashesListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.passwordHashes().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.passwordHashes() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SbomComponentsListByFirmwareSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SbomComponentsListByFirmwareSamples.java index 82db2c0317ddf..5aea2e83ef033 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SbomComponentsListByFirmwareSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SbomComponentsListByFirmwareSamples.java @@ -19,8 +19,9 @@ public final class SbomComponentsListByFirmwareSamples { */ public static void sbomComponentsListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.sbomComponents().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.sbomComponents() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -34,7 +35,8 @@ public static void sbomComponentsListByFirmwareMinimumSetGen( */ public static void sbomComponentsListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.sbomComponents().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.sbomComponents() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesGetSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesGetSamples.java index 0df6c700a4314..f8468088eaee2 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesGetSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesGetSamples.java @@ -21,8 +21,9 @@ public final class SummariesGetSamples { */ public static void summariesGetMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.summaries().getWithResponse("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - SummaryName.FIRMWARE, com.azure.core.util.Context.NONE); + manager.summaries() + .getWithResponse("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + SummaryName.FIRMWARE, com.azure.core.util.Context.NONE); } /* @@ -36,7 +37,8 @@ public final class SummariesGetSamples { */ public static void summariesGetMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.summaries().getWithResponse("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - SummaryName.FIRMWARE, com.azure.core.util.Context.NONE); + manager.summaries() + .getWithResponse("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + SummaryName.FIRMWARE, com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesListByFirmwareSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesListByFirmwareSamples.java index f69b4bd27c403..345967054cec6 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesListByFirmwareSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesListByFirmwareSamples.java @@ -19,8 +19,9 @@ public final class SummariesListByFirmwareSamples { */ public static void summariesListByFirmwareMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.summaries().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.summaries() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } /* @@ -34,7 +35,8 @@ public static void summariesListByFirmwareMinimumSetGen( */ public static void summariesListByFirmwareMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.summaries().listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", - com.azure.core.util.Context.NONE); + manager.summaries() + .listByFirmware("FirmwareAnalysisRG", "default", "109a9886-50bf-85a8-9d75-000000000000", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesCreateSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesCreateSamples.java index 8296dbf56b92f..f635def3698b2 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesCreateSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesCreateSamples.java @@ -22,8 +22,11 @@ public final class WorkspacesCreateSamples { */ public static void workspacesCreateMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().define("E___-3").withRegion("jjwbseilitjgdrhbvvkwviqj") - .withExistingResourceGroup("rgworkspaces").create(); + manager.workspaces() + .define("E___-3") + .withRegion("jjwbseilitjgdrhbvvkwviqj") + .withExistingResourceGroup("rgworkspaces") + .create(); } /* @@ -37,8 +40,12 @@ public final class WorkspacesCreateSamples { */ public static void workspacesCreateMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().define("E___-3").withRegion("jjwbseilitjgdrhbvvkwviqj") - .withExistingResourceGroup("rgworkspaces").withTags(mapOf("key450", "fakeTokenPlaceholder")).create(); + manager.workspaces() + .define("E___-3") + .withRegion("jjwbseilitjgdrhbvvkwviqj") + .withExistingResourceGroup("rgworkspaces") + .withTags(mapOf("key450", "fakeTokenPlaceholder")) + .create(); } // Use "Map.of" if available diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesDeleteSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesDeleteSamples.java index a72c6353a4aa0..8e66754ae79ee 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesDeleteSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesDeleteSamples.java @@ -19,8 +19,8 @@ public final class WorkspacesDeleteSamples { */ public static void workspacesDeleteMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().deleteByResourceGroupWithResponse("rgworkspaces", "E___-3", - com.azure.core.util.Context.NONE); + manager.workspaces() + .deleteByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE); } /* @@ -34,7 +34,7 @@ public final class WorkspacesDeleteSamples { */ public static void workspacesDeleteMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().deleteByResourceGroupWithResponse("rgworkspaces", "E___-3", - com.azure.core.util.Context.NONE); + manager.workspaces() + .deleteByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGenerateUploadUrlSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGenerateUploadUrlSamples.java index 41b565f14d2b6..78fdcd7e898e0 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGenerateUploadUrlSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGenerateUploadUrlSamples.java @@ -21,8 +21,9 @@ public final class WorkspacesGenerateUploadUrlSamples { */ public static void workspacesGenerateUploadUrlMinimumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().generateUploadUrlWithResponse("rgworkspaces", "E___-3", new GenerateUploadUrlRequest(), - com.azure.core.util.Context.NONE); + manager.workspaces() + .generateUploadUrlWithResponse("rgworkspaces", "E___-3", new GenerateUploadUrlRequest(), + com.azure.core.util.Context.NONE); } /* @@ -36,7 +37,8 @@ public static void workspacesGenerateUploadUrlMinimumSetGen( */ public static void workspacesGenerateUploadUrlMaximumSetGen( com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { - manager.workspaces().generateUploadUrlWithResponse("rgworkspaces", "E___-3", - new GenerateUploadUrlRequest().withFirmwareId("ytsfprbywi"), com.azure.core.util.Context.NONE); + manager.workspaces() + .generateUploadUrlWithResponse("rgworkspaces", "E___-3", + new GenerateUploadUrlRequest().withFirmwareId("ytsfprbywi"), com.azure.core.util.Context.NONE); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesUpdateSamples.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesUpdateSamples.java index bb5e8c8e5d868..5682b18087f2a 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesUpdateSamples.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/samples/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesUpdateSamples.java @@ -22,7 +22,8 @@ public final class WorkspacesUpdateSamples { public static void workspacesUpdateMaximumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { Workspace resource = manager.workspaces() - .getByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE).getValue(); + .getByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } @@ -38,7 +39,8 @@ public final class WorkspacesUpdateSamples { public static void workspacesUpdateMinimumSetGen(com.azure.resourcemanager.iotfirmwaredefense.IoTFirmwareDefenseManager manager) { Workspace resource = manager.workspaces() - .getByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE).getValue(); + .getByResourceGroupWithResponse("rgworkspaces", "E___-3", com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/BinaryHardeningsListByFirmwareMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/BinaryHardeningsListByFirmwareMockTests.java index ee78f0dc9f4d4..ea12c0b773895 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/BinaryHardeningsListByFirmwareMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/BinaryHardeningsListByFirmwareMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.BinaryHardeningResource; -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 BinaryHardeningsListByFirmwareMockTests { @Test public void testListByFirmware() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"binaryHardeningId\":\"rzqlveu\",\"features\":{\"nx\":true,\"pie\":false,\"relro\":true,\"canary\":true,\"stripped\":true},\"architecture\":\"cswsrtjri\",\"filePath\":\"rbpbewtghfgblcg\",\"class\":\"zvlvqhjkbegib\",\"runpath\":\"mxiebw\",\"rpath\":\"loayqcgw\"},\"id\":\"zjuzgwyz\",\"name\":\"htxongmtsavjc\",\"type\":\"pwxqp\"}]}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CvesListByFirmwareMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CvesListByFirmwareMockTests.java index 12e989e80b631..6acb107fabb77 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CvesListByFirmwareMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/CvesListByFirmwareMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.CveResource; -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 CvesListByFirmwareMockTests { @Test public void testListByFirmware() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"cveId\":\"pnapnyiropuh\",\"component\":{\"componentId\":\"vpgylgqgitxmed\",\"name\":\"c\",\"version\":\"ynqwwncwzzhxgk\"},\"severity\":\"mgucna\",\"name\":\"t\",\"cvssScore\":\"ellwptfdy\",\"cvssVersion\":\"fqbuaceopzf\",\"cvssV2Score\":\"hhuao\",\"cvssV3Score\":\"pcqeqx\",\"links\":[{\"href\":\"ahzxctobgbk\",\"label\":\"oizpostmgrcfbun\"}],\"description\":\"fqjhhkxbpvjymj\"},\"id\":\"xjyngudivk\",\"name\":\"tswb\",\"type\":\"qzvszjf\"}]}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresDeleteWithResponseMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresDeleteWithResponseMockTests.java index dc85d7ffc3574..c92e9405a5fa5 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresDeleteWithResponseMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresDeleteWithResponseMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; -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 FirmwaresDeleteWithResponseMockTests { @Test public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateDownloadUrlWithResponseMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateDownloadUrlWithResponseMockTests.java index c937a30e106fe..cedcb04128b9e 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateDownloadUrlWithResponseMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateDownloadUrlWithResponseMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.UrlToken; -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 FirmwaresGenerateDownloadUrlWithResponseMockTests { @Test public void testGenerateDownloadUrlWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"url\":\"hqlkthumaqo\"}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateFilesystemDownloadUrlWithResponseMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateFilesystemDownloadUrlWithResponseMockTests.java index 578ec8c222026..8c58a46a342e7 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateFilesystemDownloadUrlWithResponseMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/FirmwaresGenerateFilesystemDownloadUrlWithResponseMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.UrlToken; -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 FirmwaresGenerateFilesystemDownloadUrlWithResponseMockTests { @Test public void testGenerateFilesystemDownloadUrlWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"url\":\"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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/OperationsListMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/OperationsListMockTests.java index f5e8eb73547d0..bb92a780d2f41 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/OperationsListMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.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\":\"dsslswt\",\"isDataAction\":true,\"display\":{\"provider\":\"ofz\",\"resource\":\"qsemwabne\",\"operation\":\"hhszh\",\"description\":\"plvwiwubmwmbes\"},\"origin\":\"user\",\"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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SbomComponentsListByFirmwareMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SbomComponentsListByFirmwareMockTests.java index 49c144ee0dd8e..904274b57f35c 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SbomComponentsListByFirmwareMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SbomComponentsListByFirmwareMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.SbomComponentResource; -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 SbomComponentsListByFirmwareMockTests { @Test public void testListByFirmware() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"componentId\":\"lbpodxunk\",\"componentName\":\"bxmubyynt\",\"version\":\"rbqtkoie\",\"license\":\"eotg\",\"filePaths\":[\"ltmuwlauwzizx\"]},\"id\":\"pgcjefuzmuvp\",\"name\":\"ttdumorppxebmnzb\",\"type\":\"bhjpglkfgohdne\"}]}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesGetWithResponseMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesGetWithResponseMockTests.java index 2f7b3b165ffcd..f1a1ad7c3b382 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesGetWithResponseMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesGetWithResponseMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.SummaryName; import com.azure.resourcemanager.iotfirmwaredefense.models.SummaryResource; -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 SummariesGetWithResponseMockTests { @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\":{\"summaryType\":\"SummaryResourceProperties\"},\"id\":\"uflrwd\",\"name\":\"hdlxyjrxsagafcn\",\"type\":\"hgw\"}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesListByFirmwareMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesListByFirmwareMockTests.java index 6c78ed68decce..552646b22319a 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesListByFirmwareMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/SummariesListByFirmwareMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.SummaryResource; -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 SummariesListByFirmwareMockTests { @Test public void testListByFirmware() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"summaryType\":\"SummaryResourceProperties\"},\"id\":\"zx\",\"name\":\"lvithhqzonosgg\",\"type\":\"hcohfwdsjnk\"}]}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesCreateWithResponseMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesCreateWithResponseMockTests.java index 942cf292c7d68..c238c80037529 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesCreateWithResponseMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesCreateWithResponseMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.Workspace; -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 WorkspacesCreateWithResponseMockTests { @Test public void testCreateWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"properties\":{\"provisioningState\":\"Failed\"},\"location\":\"rpzbchckqqzqi\",\"tags\":{\"rwyhqmibzyhwitsm\":\"ysuiizynkedya\",\"pcdpumnz\":\"pyy\"},\"id\":\"mwzn\",\"name\":\"abikns\",\"type\":\"rgjhxb\"}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesDeleteByResourceGroupWithResponseMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesDeleteByResourceGroupWithResponseMockTests.java index 55b22abc67e6b..f7b1e59414a93 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesDeleteByResourceGroupWithResponseMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesDeleteByResourceGroupWithResponseMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; -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 WorkspacesDeleteByResourceGroupWithResponseMockTests { @Test public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGenerateUploadUrlWithResponseMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGenerateUploadUrlWithResponseMockTests.java index 724e5282c47ce..fe54985c23d5a 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGenerateUploadUrlWithResponseMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGenerateUploadUrlWithResponseMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.GenerateUploadUrlRequest; import com.azure.resourcemanager.iotfirmwaredefense.models.UrlToken; -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 WorkspacesGenerateUploadUrlWithResponseMockTests { @Test public void testGenerateUploadUrlWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"url\":\"ovvqfovljxywsu\"}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGetByResourceGroupWithResponseMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGetByResourceGroupWithResponseMockTests.java index 461af99955874..124307221aa91 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGetByResourceGroupWithResponseMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesGetByResourceGroupWithResponseMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.Workspace; -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 WorkspacesGetByResourceGroupWithResponseMockTests { @Test public void testGetByResourceGroupWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"uszdtmhrkwof\",\"tags\":{\"iexpbtgiwbwo\":\"oqac\",\"kcnqxwbpo\":\"nwashrtd\",\"aasipqi\":\"ulpiuj\"},\"id\":\"obyu\",\"name\":\"erpqlpqwcciuqg\",\"type\":\"dbutauvfbtkuwhh\"}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesListByResourceGroupMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesListByResourceGroupMockTests.java index 0d1d0e4f4baa1..f55351007446d 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesListByResourceGroupMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesListByResourceGroupMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.Workspace; -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 WorkspacesListByResourceGroupMockTests { @Test public void testListByResourceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"tmnubexkpzksmon\",\"tags\":{\"whojvp\":\"quxvypomgkop\",\"ysmocmbqfqvmkcxo\":\"jqg\"},\"id\":\"apvhelxprgly\",\"name\":\"tddckcb\",\"type\":\"uejrjxgc\"}]}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesListMockTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesListMockTests.java index c8eb088e93cbd..c2b82ae0b2b0f 100644 --- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesListMockTests.java +++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/generated/WorkspacesListMockTests.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.iotfirmwaredefense.IoTFirmwareDefenseManager; import com.azure.resourcemanager.iotfirmwaredefense.models.Workspace; -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 WorkspacesListMockTests { @Test public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"dgfbcvkcvqvpke\",\"tags\":{\"sotbob\":\"vdrhvoo\",\"ld\":\"dopcjwvnh\",\"twuoegrpkhjwni\":\"mgxcxrslpm\"},\"id\":\"qsluicp\",\"name\":\"ggkzzlvmbmpa\",\"type\":\"modfvuefywsbpfvm\"}]}"; - 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))); IoTFirmwareDefenseManager manager = IoTFirmwareDefenseManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),