From 0708fe5a7a6b2e9a76da60d73f66b790de500438 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 13 Apr 2025 19:19:12 +0000 Subject: [PATCH] CodeGen from PR 33791 in Azure/azure-rest-api-specs Merge 752f1ff5b3ef5fb4d55988f7f3a8a9ac19637670 into bec6cd80f0a570dc0bad3c18f6b517a6c5981e75 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../azure-resourcemanager-migrate/README.md | 102 ++ .../azure-resourcemanager-migrate/SAMPLE.md | 219 ++++ .../azure-resourcemanager-migrate/pom.xml | 74 ++ .../migrate/MigrateManager.java | 316 +++++ .../CompoundAssessmentOperationsClient.java | 239 ++++ ...oundAssessmentSummaryOperationsClient.java | 83 ++ .../migrate/fluent/MigrateClient.java | 69 ++ .../migrate/fluent/OperationsClient.java | 40 + .../models/CompoundAssessmentInner.java | 166 +++ .../fluent/models/DownloadUrlInner.java | 101 ++ .../migrate/fluent/models/OperationInner.java | 159 +++ .../WebAppCompoundAssessmentSummaryInner.java | 157 +++ .../migrate/fluent/models/package-info.java | 9 + .../migrate/fluent/package-info.java | 9 + .../CompoundAssessmentImpl.java | 116 ++ ...ompoundAssessmentOperationsClientImpl.java | 1101 +++++++++++++++++ .../CompoundAssessmentOperationsImpl.java | 186 +++ ...AssessmentSummaryOperationsClientImpl.java | 461 +++++++ ...mpoundAssessmentSummaryOperationsImpl.java | 76 ++ .../implementation/DownloadUrlImpl.java | 36 + .../implementation/MigrateClientBuilder.java | 138 +++ .../implementation/MigrateClientImpl.java | 320 +++++ .../migrate/implementation/OperationImpl.java | 50 + .../implementation/OperationsClientImpl.java | 235 ++++ .../implementation/OperationsImpl.java | 45 + .../implementation/ResourceManagerUtils.java | 195 +++ .../WebAppCompoundAssessmentSummaryImpl.java | 50 + .../models/CompoundAssessmentListResult.java | 114 ++ .../models/OperationListResult.java | 113 ++ ...ppCompoundAssessmentSummaryListResult.java | 116 ++ .../migrate/implementation/package-info.java | 9 + .../migrate/models/ActionType.java | 46 + .../migrate/models/AssessmentSource.java | 101 ++ .../migrate/models/AssessmentStatus.java | 86 ++ .../models/AzureManagementOfferingType.java | 66 + .../migrate/models/AzureTarget.java | 111 ++ .../models/CloudSuitabilityCommon.java | 71 ++ .../migrate/models/CompoundAssessment.java | 160 +++ .../models/CompoundAssessmentDetails.java | 136 ++ .../models/CompoundAssessmentOperations.java | 178 +++ .../models/CompoundAssessmentProperties.java | 169 +++ .../CompoundAssessmentSummaryOperations.java | 76 ++ .../migrate/models/CostDetailsCommon.java | 103 ++ .../migrate/models/CostType.java | 146 +++ .../models/DiscoveredLightSummary.java | 164 +++ .../migrate/models/DownloadUrl.java | 34 + .../migrate/models/DownloadUrlRequest.java | 63 + .../migrate/models/ManagementDetails.java | 103 ++ .../migrate/models/MigrateWorkloadType.java | 86 ++ .../migrate/models/MigrationDetails.java | 103 ++ .../migrate/models/MigrationPlatform.java | 61 + .../migrate/models/MigrationType.java | 66 + .../NameValuePairCloudSuitabilityCommon.java | 100 ++ .../migrate/models/NameValuePairCostType.java | 97 ++ .../models/NameValuePairSavingsType.java | 97 ++ .../migrate/models/Operation.java | 58 + .../migrate/models/OperationDisplay.java | 136 ++ .../migrate/models/Operations.java | 35 + .../migrate/models/Origin.java | 57 + .../migrate/models/ProvisioningState.java | 76 ++ .../migrate/models/SavingsDetailsCommon.java | 103 ++ .../migrate/models/SavingsOptions.java | 71 ++ .../migrate/models/SavingsType.java | 62 + .../migrate/models/SourceDetails.java | 129 ++ .../migrate/models/SummaryType.java | 56 + .../models/TargetAssessmentArmIds.java | 149 +++ .../migrate/models/TargetDetails.java | 129 ++ .../migrate/models/TargetSourcePair.java | 228 ++++ .../WebAppCompoundAssessmentSummary.java | 55 + ...ppCompoundAssessmentSummaryProperties.java | 242 ++++ .../migrate/models/WebAppType.java | 56 + .../migrate/models/WebAppsPerType.java | 107 ++ .../migrate/models/WebServerType.java | 56 + .../migrate/models/WebServersPerType.java | 108 ++ .../migrate/models/package-info.java | 9 + .../resourcemanager/migrate/package-info.java | 9 + .../src/main/java/module-info.java | 16 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../azure-resourcemanager-migrate.properties | 1 + ...oundAssessmentOperationsCreateSamples.java | 37 + ...oundAssessmentOperationsDeleteSamples.java | 24 + ...ssessmentOperationsDownloadUrlSamples.java | 27 + ...ompoundAssessmentOperationsGetSamples.java | 24 + ...sessmentOperationsListByParentSamples.java | 24 + ...AssessmentSummaryOperationsGetSamples.java | 25 + ...tSummaryOperationsListByParentSamples.java | 25 + .../generated/OperationsListSamples.java | 22 + .../CompoundAssessmentDetailsTests.java | 23 + .../CompoundAssessmentInnerTests.java | 39 + .../CompoundAssessmentListResultTests.java | 25 + ...ndAssessmentOperationsCreateMockTests.java | 50 + ...OperationsDeleteWithResponseMockTests.java | 34 + ...essmentOperationsDownloadUrlMockTests.java | 37 + ...entOperationsGetWithResponseMockTests.java | 42 + ...ssmentOperationsListByParentMockTests.java | 45 + .../CompoundAssessmentPropertiesTests.java | 36 + ...aryOperationsGetWithResponseMockTests.java | 52 + ...ummaryOperationsListByParentMockTests.java | 73 ++ .../generated/CostDetailsCommonTests.java | 17 + .../DiscoveredLightSummaryTests.java | 27 + .../generated/DownloadUrlInnerTests.java | 17 + .../generated/DownloadUrlRequestTests.java | 21 + .../generated/ManagementDetailsTests.java | 17 + .../generated/MigrationDetailsTests.java | 17 + ...eValuePairCloudSuitabilityCommonTests.java | 17 + .../generated/NameValuePairCostTypeTests.java | 17 + .../NameValuePairSavingsTypeTests.java | 17 + .../generated/OperationDisplayTests.java | 17 + .../generated/OperationInnerTests.java | 17 + .../generated/OperationListResultTests.java | 19 + .../generated/OperationsListMockTests.java | 36 + .../generated/SavingsDetailsCommonTests.java | 17 + .../migrate/generated/SourceDetailsTests.java | 17 + .../TargetAssessmentArmIdsTests.java | 33 + .../migrate/generated/TargetDetailsTests.java | 17 + .../generated/TargetSourcePairTests.java | 17 + ...ppCompoundAssessmentSummaryInnerTests.java | 32 + ...poundAssessmentSummaryListResultTests.java | 42 + ...poundAssessmentSummaryPropertiesTests.java | 30 + .../generated/WebAppsPerTypeTests.java | 20 + .../generated/WebServersPerTypeTests.java | 20 + .../tsp-location.yaml | 5 + sdk/migrate/ci.yml | 46 + sdk/migrate/pom.xml | 15 + 128 files changed, 10718 insertions(+) create mode 100644 sdk/migrate/azure-resourcemanager-migrate/CHANGELOG.md create mode 100644 sdk/migrate/azure-resourcemanager-migrate/README.md create mode 100644 sdk/migrate/azure-resourcemanager-migrate/SAMPLE.md create mode 100644 sdk/migrate/azure-resourcemanager-migrate/pom.xml create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/MigrateManager.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/CompoundAssessmentOperationsClient.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/CompoundAssessmentSummaryOperationsClient.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/MigrateClient.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/OperationsClient.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/CompoundAssessmentInner.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/DownloadUrlInner.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/OperationInner.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/WebAppCompoundAssessmentSummaryInner.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/package-info.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/package-info.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentOperationsClientImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentOperationsImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentSummaryOperationsClientImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentSummaryOperationsImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/DownloadUrlImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/MigrateClientBuilder.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/MigrateClientImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationsClientImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationsImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/ResourceManagerUtils.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/WebAppCompoundAssessmentSummaryImpl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/CompoundAssessmentListResult.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/OperationListResult.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/WebAppCompoundAssessmentSummaryListResult.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/package-info.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ActionType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AssessmentSource.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AssessmentStatus.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AzureManagementOfferingType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AzureTarget.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CloudSuitabilityCommon.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessment.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentDetails.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentOperations.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentProperties.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentSummaryOperations.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CostDetailsCommon.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CostType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DiscoveredLightSummary.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DownloadUrl.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DownloadUrlRequest.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ManagementDetails.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrateWorkloadType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationDetails.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationPlatform.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairCloudSuitabilityCommon.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairCostType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairSavingsType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Operation.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/OperationDisplay.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Operations.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Origin.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ProvisioningState.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsDetailsCommon.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsOptions.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SourceDetails.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SummaryType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetAssessmentArmIds.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetDetails.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetSourcePair.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppCompoundAssessmentSummary.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppCompoundAssessmentSummaryProperties.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppsPerType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebServerType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebServersPerType.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/package-info.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/package-info.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/java/module-info.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-migrate/proxy-config.json create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-migrate/reflect-config.json create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/main/resources/azure-resourcemanager-migrate.properties create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsCreateSamples.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDeleteSamples.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDownloadUrlSamples.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsGetSamples.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsListByParentSamples.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsGetSamples.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsListByParentSamples.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/OperationsListSamples.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentDetailsTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentInnerTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentListResultTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsCreateMockTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDeleteWithResponseMockTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDownloadUrlMockTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsGetWithResponseMockTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsListByParentMockTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentPropertiesTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsGetWithResponseMockTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsListByParentMockTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CostDetailsCommonTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DiscoveredLightSummaryTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DownloadUrlInnerTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DownloadUrlRequestTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/ManagementDetailsTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/MigrationDetailsTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairCloudSuitabilityCommonTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairCostTypeTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairSavingsTypeTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationDisplayTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationInnerTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationListResultTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationsListMockTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/SavingsDetailsCommonTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/SourceDetailsTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetAssessmentArmIdsTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetDetailsTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetSourcePairTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryInnerTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryListResultTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryPropertiesTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppsPerTypeTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebServersPerTypeTests.java create mode 100644 sdk/migrate/azure-resourcemanager-migrate/tsp-location.yaml create mode 100644 sdk/migrate/ci.yml create mode 100644 sdk/migrate/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index a7b0d2c20e16..b151233ae65d 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -473,6 +473,7 @@ com.azure.resourcemanager:azure-resourcemanager-databasewatcher;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-durabletask;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-arizeaiobservabilityeval;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-migrate;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index ff71d092c5bb..22d1f86d1099 100644 --- a/pom.xml +++ b/pom.xml @@ -144,6 +144,7 @@ sdk/marketplaceordering sdk/mediaservices sdk/metricsadvisor + sdk/migrate sdk/migration sdk/migrationdiscoverysap sdk/mixedreality diff --git a/sdk/migrate/azure-resourcemanager-migrate/CHANGELOG.md b/sdk/migrate/azure-resourcemanager-migrate/CHANGELOG.md new file mode 100644 index 000000000000..92c0defc9be1 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-13) + +- Azure Resource Manager migrate client library for Java. This package contains Microsoft Azure SDK for migrate Management SDK. Azure Migrate Resource Provider management API. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-migrate Java SDK. diff --git a/sdk/migrate/azure-resourcemanager-migrate/README.md b/sdk/migrate/azure-resourcemanager-migrate/README.md new file mode 100644 index 000000000000..368e170b2524 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager migrate client library for Java + +Azure Resource Manager migrate client library for Java. + +This package contains Microsoft Azure SDK for migrate Management SDK. Azure Migrate Resource Provider management API. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-migrate;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-migrate + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +MigrateManager manager = MigrateManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/migrate/azure-resourcemanager-migrate/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/migrate/azure-resourcemanager-migrate/SAMPLE.md b/sdk/migrate/azure-resourcemanager-migrate/SAMPLE.md new file mode 100644 index 000000000000..e2e1715234bb --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/SAMPLE.md @@ -0,0 +1,219 @@ +# Code snippets and samples + + +## CompoundAssessmentOperations + +- [Create](#compoundassessmentoperations_create) +- [Delete](#compoundassessmentoperations_delete) +- [DownloadUrl](#compoundassessmentoperations_downloadurl) +- [Get](#compoundassessmentoperations_get) +- [ListByParent](#compoundassessmentoperations_listbyparent) + +## CompoundAssessmentSummaryOperations + +- [Get](#compoundassessmentsummaryoperations_get) +- [ListByParent](#compoundassessmentsummaryoperations_listbyparent) + +## Operations + +- [List](#operations_list) +### CompoundAssessmentOperations_Create + +```java +import com.azure.resourcemanager.migrate.models.CompoundAssessmentProperties; +import com.azure.resourcemanager.migrate.models.TargetAssessmentArmIds; + +/** + * Samples for CompoundAssessmentOperations Create. + */ +public final class CompoundAssessmentOperationsCreateSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_Create_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_Create. + * + * @param manager Entry point to MigrateManager. + */ + public static void compoundAssessmentOperationsCreate(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .define("assessmentName") + .withExistingAssessmentProject("rgwebAppCompoundAssessments", "contosoProject") + .withProperties(new CompoundAssessmentProperties().withTargetAssessmentArmIds(new TargetAssessmentArmIds() + .withAks( + "/subscriptions/6898488D-BBF0-40FC-A5E3-3DF2C00C5F21/resourceGroups/rgwebAppCompoundAssessments/providers/Microsoft.Migrate/assessmentprojects/contosoProject/aksAssessments/nameOfAssessment") + .withAzureAppService( + "/subscriptions/6898488D-BBF0-40FC-A5E3-3DF2C00C5F21/resourceGroups/rgwebAppCompoundAssessments/providers/Microsoft.Migrate/assessmentprojects/contosoProject/webAppAssessments/nameOfAssessment") + .withAzureAppServiceContainer( + "/subscriptions/6898488D-BBF0-40FC-A5E3-3DF2C00C5F21/resourceGroups/rgwebAppCompoundAssessments/providers/Microsoft.Migrate/assessmentprojects/contosoProject/webAppAssessments/nameOfAssessment")) + .withFallbackMachineAssessmentArmId( + "/subscriptions/6898488D-BBF0-40FC-A5E3-3DF2C00C5F21/resourceGroups/rgwebAppCompoundAssessments/providers/Microsoft.Migrate/assessmentprojects/contosoProject/assessments/nameOfAssessment")) + .create(); + } +} +``` + +### CompoundAssessmentOperations_Delete + +```java +import com.azure.resourcemanager.migrate.models.DownloadUrlRequest; + +/** + * Samples for CompoundAssessmentOperations DownloadUrl. + */ +public final class CompoundAssessmentOperationsDownloadUrlSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_DownloadUrl_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_DownloadUrl. + * + * @param manager Entry point to MigrateManager. + */ + public static void + compoundAssessmentOperationsDownloadUrl(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .downloadUrl("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", new DownloadUrlRequest(), + com.azure.core.util.Context.NONE); + } +} +``` + +### CompoundAssessmentOperations_DownloadUrl + +```java +/** + * Samples for CompoundAssessmentOperations ListByParent. + */ +public final class CompoundAssessmentOperationsListByParentSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_ListByParent_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_ListByParent. + * + * @param manager Entry point to MigrateManager. + */ + public static void + compoundAssessmentOperationsListByParent(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .listByParent("rgwebAppCompoundAssessments", "contosoProject", com.azure.core.util.Context.NONE); + } +} +``` + +### CompoundAssessmentOperations_Get + +```java +/** + * Samples for CompoundAssessmentSummaryOperations ListByParent. + */ +public final class CompoundAssessmentSummaryOperationsListByParentSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentSummaryOperations_ListByParent_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentSummaryOperations_ListByParent. + * + * @param manager Entry point to MigrateManager. + */ + public static void + compoundAssessmentSummaryOperationsListByParent(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentSummaryOperations() + .listByParent("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", + com.azure.core.util.Context.NONE); + } +} +``` + +### CompoundAssessmentOperations_ListByParent + +```java +/** + * Samples for CompoundAssessmentOperations Get. + */ +public final class CompoundAssessmentOperationsGetSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_Get_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_Get. + * + * @param manager Entry point to MigrateManager. + */ + public static void compoundAssessmentOperationsGet(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .getWithResponse("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", + com.azure.core.util.Context.NONE); + } +} +``` + +### CompoundAssessmentSummaryOperations_Get + +```java +/** + * Samples for CompoundAssessmentSummaryOperations Get. + */ +public final class CompoundAssessmentSummaryOperationsGetSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentSummaryOperations_Get_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentSummaryOperations_Get. + * + * @param manager Entry point to MigrateManager. + */ + public static void + compoundAssessmentSummaryOperationsGet(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentSummaryOperations() + .getWithResponse("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", "Modernize", + com.azure.core.util.Context.NONE); + } +} +``` + +### CompoundAssessmentSummaryOperations_ListByParent + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2024-03-03-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MigrateManager. + */ + public static void operationsList(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for CompoundAssessmentOperations Delete. + */ +public final class CompoundAssessmentOperationsDeleteSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_Delete. + * + * @param manager Entry point to MigrateManager. + */ + public static void compoundAssessmentOperationsDelete(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .deleteWithResponse("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", + com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/migrate/azure-resourcemanager-migrate/pom.xml b/sdk/migrate/azure-resourcemanager-migrate/pom.xml new file mode 100644 index 000000000000..42b363c46a3b --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-migrate + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for migrate Management + This package contains Microsoft Azure SDK for migrate Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Migrate Resource Provider management API. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + com.azure + azure-core-test + 1.27.0-beta.8 + test + + + com.azure + azure-identity + 1.15.4 + test + + + diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/MigrateManager.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/MigrateManager.java new file mode 100644 index 000000000000..2ed258a36ada --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/MigrateManager.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +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.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.migrate.fluent.MigrateClient; +import com.azure.resourcemanager.migrate.implementation.CompoundAssessmentOperationsImpl; +import com.azure.resourcemanager.migrate.implementation.CompoundAssessmentSummaryOperationsImpl; +import com.azure.resourcemanager.migrate.implementation.MigrateClientBuilder; +import com.azure.resourcemanager.migrate.implementation.OperationsImpl; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentOperations; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentSummaryOperations; +import com.azure.resourcemanager.migrate.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to MigrateManager. + * Azure Migrate Resource Provider management API. + */ +public final class MigrateManager { + private Operations operations; + + private CompoundAssessmentOperations compoundAssessmentOperations; + + private CompoundAssessmentSummaryOperations compoundAssessmentSummaryOperations; + + private final MigrateClient clientObject; + + private MigrateManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MigrateClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of migrate service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the migrate service API instance. + */ + public static MigrateManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of migrate service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the migrate service API instance. + */ + public static MigrateManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MigrateManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create MigrateManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MigrateManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-migrate.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of migrate service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the migrate service API instance. + */ + public MigrateManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.migrate") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + 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())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new MigrateManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of CompoundAssessmentOperations. It manages CompoundAssessment. + * + * @return Resource collection API of CompoundAssessmentOperations. + */ + public CompoundAssessmentOperations compoundAssessmentOperations() { + if (this.compoundAssessmentOperations == null) { + this.compoundAssessmentOperations + = new CompoundAssessmentOperationsImpl(clientObject.getCompoundAssessmentOperations(), this); + } + return compoundAssessmentOperations; + } + + /** + * Gets the resource collection API of CompoundAssessmentSummaryOperations. + * + * @return Resource collection API of CompoundAssessmentSummaryOperations. + */ + public CompoundAssessmentSummaryOperations compoundAssessmentSummaryOperations() { + if (this.compoundAssessmentSummaryOperations == null) { + this.compoundAssessmentSummaryOperations = new CompoundAssessmentSummaryOperationsImpl( + clientObject.getCompoundAssessmentSummaryOperations(), this); + } + return compoundAssessmentSummaryOperations; + } + + /** + * Gets wrapped service client MigrateClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client MigrateClient. + */ + public MigrateClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/CompoundAssessmentOperationsClient.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/CompoundAssessmentOperationsClient.java new file mode 100644 index 000000000000..11e473d651c5 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/CompoundAssessmentOperationsClient.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.migrate.fluent.models.CompoundAssessmentInner; +import com.azure.resourcemanager.migrate.fluent.models.DownloadUrlInner; +import com.azure.resourcemanager.migrate.models.DownloadUrlRequest; + +/** + * An instance of this class provides access to all the operations defined in CompoundAssessmentOperationsClient. + */ +public interface CompoundAssessmentOperationsClient { + /** + * Get a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context); + + /** + * Get a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CompoundAssessmentInner get(String resourceGroupName, String projectName, String compoundAssessmentName); + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceGroupName, String projectName); + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceGroupName, String projectName, Context context); + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CompoundAssessmentInner> beginCreate(String resourceGroupName, + String projectName, String compoundAssessmentName, CompoundAssessmentInner resource); + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CompoundAssessmentInner> beginCreate(String resourceGroupName, + String projectName, String compoundAssessmentName, CompoundAssessmentInner resource, Context context); + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CompoundAssessmentInner create(String resourceGroupName, String projectName, String compoundAssessmentName, + CompoundAssessmentInner resource); + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CompoundAssessmentInner create(String resourceGroupName, String projectName, String compoundAssessmentName, + CompoundAssessmentInner resource, Context context); + + /** + * Delete a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String projectName, String compoundAssessmentName, + Context context); + + /** + * Delete a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String projectName, String compoundAssessmentName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DownloadUrlInner> beginDownloadUrl(String resourceGroupName, + String projectName, String compoundAssessmentName, DownloadUrlRequest body); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DownloadUrlInner> beginDownloadUrl(String resourceGroupName, + String projectName, String compoundAssessmentName, DownloadUrlRequest body, Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadUrl(String resourceGroupName, String projectName, String compoundAssessmentName, + DownloadUrlRequest body); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadUrl(String resourceGroupName, String projectName, String compoundAssessmentName, + DownloadUrlRequest body, Context context); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/CompoundAssessmentSummaryOperationsClient.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/CompoundAssessmentSummaryOperationsClient.java new file mode 100644 index 000000000000..c94bb41fbafc --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/CompoundAssessmentSummaryOperationsClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.migrate.fluent.models.WebAppCompoundAssessmentSummaryInner; + +/** + * An instance of this class provides access to all the operations defined in CompoundAssessmentSummaryOperationsClient. + */ +public interface CompoundAssessmentSummaryOperationsClient { + /** + * Get a WebAppCompoundAssessmentSummary. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param summaryName Gets the Name of the WebApp compound assessment summary. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WebAppCompoundAssessmentSummary along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, String summaryName, Context context); + + /** + * Get a WebAppCompoundAssessmentSummary. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param summaryName Gets the Name of the WebApp compound assessment summary. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WebAppCompoundAssessmentSummary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WebAppCompoundAssessmentSummaryInner get(String resourceGroupName, String projectName, + String compoundAssessmentName, String summaryName); + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceGroupName, String projectName, + String compoundAssessmentName); + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/MigrateClient.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/MigrateClient.java new file mode 100644 index 000000000000..de21ae7e8401 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/MigrateClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MigrateClient class. + */ +public interface MigrateClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CompoundAssessmentOperationsClient object to access its operations. + * + * @return the CompoundAssessmentOperationsClient object. + */ + CompoundAssessmentOperationsClient getCompoundAssessmentOperations(); + + /** + * Gets the CompoundAssessmentSummaryOperationsClient object to access its operations. + * + * @return the CompoundAssessmentSummaryOperationsClient object. + */ + CompoundAssessmentSummaryOperationsClient getCompoundAssessmentSummaryOperations(); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/OperationsClient.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/OperationsClient.java new file mode 100644 index 000000000000..8b9af5d52240 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.migrate.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/CompoundAssessmentInner.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/CompoundAssessmentInner.java new file mode 100644 index 000000000000..ae371edd731c --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/CompoundAssessmentInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentProperties; +import java.io.IOException; + +/** + * Compound assessment resource. + */ +@Fluent +public final class CompoundAssessmentInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private CompoundAssessmentProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CompoundAssessmentInner class. + */ + public CompoundAssessmentInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public CompoundAssessmentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the CompoundAssessmentInner object itself. + */ + public CompoundAssessmentInner withProperties(CompoundAssessmentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CompoundAssessmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CompoundAssessmentInner 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 CompoundAssessmentInner. + */ + public static CompoundAssessmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CompoundAssessmentInner deserializedCompoundAssessmentInner = new CompoundAssessmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCompoundAssessmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCompoundAssessmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCompoundAssessmentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCompoundAssessmentInner.properties = CompoundAssessmentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCompoundAssessmentInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCompoundAssessmentInner; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/DownloadUrlInner.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/DownloadUrlInner.java new file mode 100644 index 000000000000..a7d16cccd320 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/DownloadUrlInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Data model of Download URL for assessment report. + */ +@Immutable +public final class DownloadUrlInner implements JsonSerializable { + /* + * Hyperlink to download report. + */ + private String assessmentReportUrl; + + /* + * Expiry date of download url. + */ + private OffsetDateTime expirationTime; + + /** + * Creates an instance of DownloadUrlInner class. + */ + private DownloadUrlInner() { + } + + /** + * Get the assessmentReportUrl property: Hyperlink to download report. + * + * @return the assessmentReportUrl value. + */ + public String assessmentReportUrl() { + return this.assessmentReportUrl; + } + + /** + * Get the expirationTime property: Expiry date of download url. + * + * @return the expirationTime value. + */ + public OffsetDateTime expirationTime() { + return this.expirationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DownloadUrlInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DownloadUrlInner 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 DownloadUrlInner. + */ + public static DownloadUrlInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DownloadUrlInner deserializedDownloadUrlInner = new DownloadUrlInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessmentReportUrl".equals(fieldName)) { + deserializedDownloadUrlInner.assessmentReportUrl = reader.getString(); + } else if ("expirationTime".equals(fieldName)) { + deserializedDownloadUrlInner.expirationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDownloadUrlInner; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/OperationInner.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/OperationInner.java new file mode 100644 index 000000000000..1a6e856dd042 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/OperationInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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.migrate.models.ActionType; +import com.azure.resourcemanager.migrate.models.OperationDisplay; +import com.azure.resourcemanager.migrate.models.Origin; +import java.io.IOException; + +/** + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +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" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + 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" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + 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/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/WebAppCompoundAssessmentSummaryInner.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/WebAppCompoundAssessmentSummaryInner.java new file mode 100644 index 000000000000..aedb973f222c --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/WebAppCompoundAssessmentSummaryInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.fluent.models; + +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.migrate.models.WebAppCompoundAssessmentSummaryProperties; +import java.io.IOException; + +/** + * WebApp compound assessment summary resource. + */ +@Immutable +public final class WebAppCompoundAssessmentSummaryInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private WebAppCompoundAssessmentSummaryProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WebAppCompoundAssessmentSummaryInner class. + */ + private WebAppCompoundAssessmentSummaryInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public WebAppCompoundAssessmentSummaryProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebAppCompoundAssessmentSummaryInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebAppCompoundAssessmentSummaryInner 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 WebAppCompoundAssessmentSummaryInner. + */ + public static WebAppCompoundAssessmentSummaryInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebAppCompoundAssessmentSummaryInner deserializedWebAppCompoundAssessmentSummaryInner + = new WebAppCompoundAssessmentSummaryInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryInner.properties + = WebAppCompoundAssessmentSummaryProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWebAppCompoundAssessmentSummaryInner; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/package-info.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/package-info.java new file mode 100644 index 000000000000..2e96b34b740e --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for Migrate. + * Azure Migrate Resource Provider management API. + */ +package com.azure.resourcemanager.migrate.fluent.models; diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/package-info.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/package-info.java new file mode 100644 index 000000000000..5fe3fd4e2a93 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for Migrate. + * Azure Migrate Resource Provider management API. + */ +package com.azure.resourcemanager.migrate.fluent; diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentImpl.java new file mode 100644 index 000000000000..9468ed626c6d --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentImpl.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.migrate.fluent.models.CompoundAssessmentInner; +import com.azure.resourcemanager.migrate.models.CompoundAssessment; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentProperties; +import com.azure.resourcemanager.migrate.models.DownloadUrl; +import com.azure.resourcemanager.migrate.models.DownloadUrlRequest; + +public final class CompoundAssessmentImpl implements CompoundAssessment, CompoundAssessment.Definition { + private CompoundAssessmentInner innerObject; + + private final com.azure.resourcemanager.migrate.MigrateManager serviceManager; + + CompoundAssessmentImpl(CompoundAssessmentInner innerObject, + com.azure.resourcemanager.migrate.MigrateManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public CompoundAssessmentProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public CompoundAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.migrate.MigrateManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String projectName; + + private String compoundAssessmentName; + + public CompoundAssessmentImpl withExistingAssessmentProject(String resourceGroupName, String projectName) { + this.resourceGroupName = resourceGroupName; + this.projectName = projectName; + return this; + } + + public CompoundAssessment create() { + this.innerObject = serviceManager.serviceClient() + .getCompoundAssessmentOperations() + .create(resourceGroupName, projectName, compoundAssessmentName, this.innerModel(), Context.NONE); + return this; + } + + public CompoundAssessment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCompoundAssessmentOperations() + .create(resourceGroupName, projectName, compoundAssessmentName, this.innerModel(), context); + return this; + } + + CompoundAssessmentImpl(String name, com.azure.resourcemanager.migrate.MigrateManager serviceManager) { + this.innerObject = new CompoundAssessmentInner(); + this.serviceManager = serviceManager; + this.compoundAssessmentName = name; + } + + public CompoundAssessment refresh() { + this.innerObject = serviceManager.serviceClient() + .getCompoundAssessmentOperations() + .getWithResponse(resourceGroupName, projectName, compoundAssessmentName, Context.NONE) + .getValue(); + return this; + } + + public CompoundAssessment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCompoundAssessmentOperations() + .getWithResponse(resourceGroupName, projectName, compoundAssessmentName, context) + .getValue(); + return this; + } + + public DownloadUrl downloadUrl(DownloadUrlRequest body) { + return serviceManager.compoundAssessmentOperations() + .downloadUrl(resourceGroupName, projectName, compoundAssessmentName, body); + } + + public DownloadUrl downloadUrl(DownloadUrlRequest body, Context context) { + return serviceManager.compoundAssessmentOperations() + .downloadUrl(resourceGroupName, projectName, compoundAssessmentName, body, context); + } + + public CompoundAssessmentImpl withProperties(CompoundAssessmentProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentOperationsClientImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentOperationsClientImpl.java new file mode 100644 index 000000000000..6d6eb2620c07 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentOperationsClientImpl.java @@ -0,0 +1,1101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.migrate.fluent.CompoundAssessmentOperationsClient; +import com.azure.resourcemanager.migrate.fluent.models.CompoundAssessmentInner; +import com.azure.resourcemanager.migrate.fluent.models.DownloadUrlInner; +import com.azure.resourcemanager.migrate.implementation.models.CompoundAssessmentListResult; +import com.azure.resourcemanager.migrate.models.DownloadUrlRequest; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CompoundAssessmentOperationsClient. + */ +public final class CompoundAssessmentOperationsClientImpl implements CompoundAssessmentOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CompoundAssessmentOperationsService service; + + /** + * The service client containing this operation class. + */ + private final MigrateClientImpl client; + + /** + * Initializes an instance of CompoundAssessmentOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CompoundAssessmentOperationsClientImpl(MigrateClientImpl client) { + this.service = RestProxy.create(CompoundAssessmentOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MigrateClientCompoundAssessmentOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MigrateClientCompoun") + public interface CompoundAssessmentOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCompoundAssessments/{compoundAssessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("projectName") String projectName, + @PathParam("compoundAssessmentName") String compoundAssessmentName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCompoundAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParent(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("projectName") String projectName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCompoundAssessments/{compoundAssessmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("projectName") String projectName, + @PathParam("compoundAssessmentName") String compoundAssessmentName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CompoundAssessmentInner resource, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCompoundAssessments/{compoundAssessmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("projectName") String projectName, + @PathParam("compoundAssessmentName") String compoundAssessmentName, @HeaderParam("Accept") String accept, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCompoundAssessments/{compoundAssessmentName}/downloadUrl") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> downloadUrl(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("projectName") String projectName, + @PathParam("compoundAssessmentName") String compoundAssessmentName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DownloadUrlRequest body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String projectName, + String compoundAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, projectName, compoundAssessmentName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, projectName, compoundAssessmentName, accept, context); + } + + /** + * Get a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String projectName, + String compoundAssessmentName) { + return getWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context) { + return getWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName, context).block(); + } + + /** + * Get a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CompoundAssessmentInner get(String resourceGroupName, String projectName, String compoundAssessmentName) { + return getWithResponse(resourceGroupName, projectName, compoundAssessmentName, Context.NONE).getValue(); + } + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentSinglePageAsync(String resourceGroupName, + String projectName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByParent(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, projectName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentSinglePageAsync(String resourceGroupName, + String projectName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByParent(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, projectName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByParentAsync(String resourceGroupName, String projectName) { + return new PagedFlux<>(() -> listByParentSinglePageAsync(resourceGroupName, projectName), + nextLink -> listByParentNextSinglePageAsync(nextLink)); + } + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByParentAsync(String resourceGroupName, String projectName, + Context context) { + return new PagedFlux<>(() -> listByParentSinglePageAsync(resourceGroupName, projectName, context), + nextLink -> listByParentNextSinglePageAsync(nextLink, context)); + } + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceGroupName, String projectName) { + return new PagedIterable<>(listByParentAsync(resourceGroupName, projectName)); + } + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceGroupName, String projectName, + Context context) { + return new PagedIterable<>(listByParentAsync(resourceGroupName, projectName, context)); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compound assessment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, CompoundAssessmentInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, projectName, compoundAssessmentName, contentType, + accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compound assessment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, CompoundAssessmentInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, projectName, compoundAssessmentName, contentType, accept, resource, context); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CompoundAssessmentInner> beginCreateAsync( + String resourceGroupName, String projectName, String compoundAssessmentName, CompoundAssessmentInner resource) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CompoundAssessmentInner.class, CompoundAssessmentInner.class, + this.client.getContext()); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CompoundAssessmentInner> beginCreateAsync( + String resourceGroupName, String projectName, String compoundAssessmentName, CompoundAssessmentInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CompoundAssessmentInner.class, CompoundAssessmentInner.class, context); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CompoundAssessmentInner> beginCreate( + String resourceGroupName, String projectName, String compoundAssessmentName, CompoundAssessmentInner resource) { + return this.beginCreateAsync(resourceGroupName, projectName, compoundAssessmentName, resource).getSyncPoller(); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CompoundAssessmentInner> beginCreate( + String resourceGroupName, String projectName, String compoundAssessmentName, CompoundAssessmentInner resource, + Context context) { + return this.beginCreateAsync(resourceGroupName, projectName, compoundAssessmentName, resource, context) + .getSyncPoller(); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compound assessment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, CompoundAssessmentInner resource) { + return beginCreateAsync(resourceGroupName, projectName, compoundAssessmentName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compound assessment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, CompoundAssessmentInner resource, Context context) { + return beginCreateAsync(resourceGroupName, projectName, compoundAssessmentName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CompoundAssessmentInner create(String resourceGroupName, String projectName, String compoundAssessmentName, + CompoundAssessmentInner resource) { + return createAsync(resourceGroupName, projectName, compoundAssessmentName, resource).block(); + } + + /** + * Create a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return compound assessment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CompoundAssessmentInner create(String resourceGroupName, String projectName, String compoundAssessmentName, + CompoundAssessmentInner resource, Context context) { + return createAsync(resourceGroupName, projectName, compoundAssessmentName, resource, context).block(); + } + + /** + * Delete a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String projectName, + String compoundAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, projectName, compoundAssessmentName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, projectName, compoundAssessmentName, accept, context); + } + + /** + * Delete a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String projectName, String compoundAssessmentName) { + return deleteWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context) { + return deleteWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName, context).block(); + } + + /** + * Delete a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String projectName, String compoundAssessmentName) { + deleteWithResponse(resourceGroupName, projectName, compoundAssessmentName, Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadUrlWithResponseAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, DownloadUrlRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.downloadUrl(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, projectName, compoundAssessmentName, contentType, + accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadUrlWithResponseAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, DownloadUrlRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.downloadUrl(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, projectName, compoundAssessmentName, contentType, + accept, body, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DownloadUrlInner> beginDownloadUrlAsync(String resourceGroupName, + String projectName, String compoundAssessmentName, DownloadUrlRequest body) { + Mono>> mono + = downloadUrlWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DownloadUrlInner.class, DownloadUrlInner.class, this.client.getContext()); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DownloadUrlInner> beginDownloadUrlAsync(String resourceGroupName, + String projectName, String compoundAssessmentName, DownloadUrlRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = downloadUrlWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DownloadUrlInner.class, DownloadUrlInner.class, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DownloadUrlInner> beginDownloadUrl(String resourceGroupName, + String projectName, String compoundAssessmentName, DownloadUrlRequest body) { + return this.beginDownloadUrlAsync(resourceGroupName, projectName, compoundAssessmentName, body).getSyncPoller(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DownloadUrlInner> beginDownloadUrl(String resourceGroupName, + String projectName, String compoundAssessmentName, DownloadUrlRequest body, Context context) { + return this.beginDownloadUrlAsync(resourceGroupName, projectName, compoundAssessmentName, body, context) + .getSyncPoller(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadUrlAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, DownloadUrlRequest body) { + return beginDownloadUrlAsync(resourceGroupName, projectName, compoundAssessmentName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadUrlAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, DownloadUrlRequest body, Context context) { + return beginDownloadUrlAsync(resourceGroupName, projectName, compoundAssessmentName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadUrl(String resourceGroupName, String projectName, String compoundAssessmentName, + DownloadUrlRequest body) { + return downloadUrlAsync(resourceGroupName, projectName, compoundAssessmentName, body).block(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadUrl(String resourceGroupName, String projectName, String compoundAssessmentName, + DownloadUrlRequest body, Context context) { + return downloadUrlAsync(resourceGroupName, projectName, compoundAssessmentName, body, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByParentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByParentNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentOperationsImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentOperationsImpl.java new file mode 100644 index 000000000000..1814b7dfd907 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentOperationsImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.migrate.fluent.CompoundAssessmentOperationsClient; +import com.azure.resourcemanager.migrate.fluent.models.CompoundAssessmentInner; +import com.azure.resourcemanager.migrate.fluent.models.DownloadUrlInner; +import com.azure.resourcemanager.migrate.models.CompoundAssessment; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentOperations; +import com.azure.resourcemanager.migrate.models.DownloadUrl; +import com.azure.resourcemanager.migrate.models.DownloadUrlRequest; + +public final class CompoundAssessmentOperationsImpl implements CompoundAssessmentOperations { + private static final ClientLogger LOGGER = new ClientLogger(CompoundAssessmentOperationsImpl.class); + + private final CompoundAssessmentOperationsClient innerClient; + + private final com.azure.resourcemanager.migrate.MigrateManager serviceManager; + + public CompoundAssessmentOperationsImpl(CompoundAssessmentOperationsClient innerClient, + com.azure.resourcemanager.migrate.MigrateManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, projectName, compoundAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CompoundAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CompoundAssessment get(String resourceGroupName, String projectName, String compoundAssessmentName) { + CompoundAssessmentInner inner + = this.serviceClient().get(resourceGroupName, projectName, compoundAssessmentName); + if (inner != null) { + return new CompoundAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByParent(String resourceGroupName, String projectName) { + PagedIterable inner + = this.serviceClient().listByParent(resourceGroupName, projectName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CompoundAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByParent(String resourceGroupName, String projectName, + Context context) { + PagedIterable inner + = this.serviceClient().listByParent(resourceGroupName, projectName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CompoundAssessmentImpl(inner1, this.manager())); + } + + public Response deleteWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, projectName, compoundAssessmentName, context); + } + + public void delete(String resourceGroupName, String projectName, String compoundAssessmentName) { + this.serviceClient().delete(resourceGroupName, projectName, compoundAssessmentName); + } + + public DownloadUrl downloadUrl(String resourceGroupName, String projectName, String compoundAssessmentName, + DownloadUrlRequest body) { + DownloadUrlInner inner + = this.serviceClient().downloadUrl(resourceGroupName, projectName, compoundAssessmentName, body); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + public DownloadUrl downloadUrl(String resourceGroupName, String projectName, String compoundAssessmentName, + DownloadUrlRequest body, Context context) { + DownloadUrlInner inner + = this.serviceClient().downloadUrl(resourceGroupName, projectName, compoundAssessmentName, body, context); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + public CompoundAssessment getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "assessmentProjects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessmentProjects'.", id))); + } + String compoundAssessmentName = ResourceManagerUtils.getValueFromIdByName(id, "webAppCompoundAssessments"); + if (compoundAssessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'webAppCompoundAssessments'.", id))); + } + return this.getWithResponse(resourceGroupName, projectName, compoundAssessmentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "assessmentProjects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessmentProjects'.", id))); + } + String compoundAssessmentName = ResourceManagerUtils.getValueFromIdByName(id, "webAppCompoundAssessments"); + if (compoundAssessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'webAppCompoundAssessments'.", id))); + } + return this.getWithResponse(resourceGroupName, projectName, compoundAssessmentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "assessmentProjects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessmentProjects'.", id))); + } + String compoundAssessmentName = ResourceManagerUtils.getValueFromIdByName(id, "webAppCompoundAssessments"); + if (compoundAssessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'webAppCompoundAssessments'.", id))); + } + this.deleteWithResponse(resourceGroupName, projectName, compoundAssessmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "assessmentProjects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessmentProjects'.", id))); + } + String compoundAssessmentName = ResourceManagerUtils.getValueFromIdByName(id, "webAppCompoundAssessments"); + if (compoundAssessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'webAppCompoundAssessments'.", id))); + } + return this.deleteWithResponse(resourceGroupName, projectName, compoundAssessmentName, context); + } + + private CompoundAssessmentOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.migrate.MigrateManager manager() { + return this.serviceManager; + } + + public CompoundAssessmentImpl define(String name) { + return new CompoundAssessmentImpl(name, this.manager()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentSummaryOperationsClientImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentSummaryOperationsClientImpl.java new file mode 100644 index 000000000000..be4dc423a7f8 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentSummaryOperationsClientImpl.java @@ -0,0 +1,461 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.migrate.fluent.CompoundAssessmentSummaryOperationsClient; +import com.azure.resourcemanager.migrate.fluent.models.WebAppCompoundAssessmentSummaryInner; +import com.azure.resourcemanager.migrate.implementation.models.WebAppCompoundAssessmentSummaryListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CompoundAssessmentSummaryOperationsClient. + */ +public final class CompoundAssessmentSummaryOperationsClientImpl implements CompoundAssessmentSummaryOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CompoundAssessmentSummaryOperationsService service; + + /** + * The service client containing this operation class. + */ + private final MigrateClientImpl client; + + /** + * Initializes an instance of CompoundAssessmentSummaryOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CompoundAssessmentSummaryOperationsClientImpl(MigrateClientImpl client) { + this.service = RestProxy.create(CompoundAssessmentSummaryOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MigrateClientCompoundAssessmentSummaryOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MigrateClientCompoun") + public interface CompoundAssessmentSummaryOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCompoundAssessments/{compoundAssessmentName}/summaries/{summaryName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("projectName") String projectName, + @PathParam("compoundAssessmentName") String compoundAssessmentName, + @PathParam("summaryName") String summaryName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCompoundAssessments/{compoundAssessmentName}/summaries") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParent(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("projectName") String projectName, + @PathParam("compoundAssessmentName") String compoundAssessmentName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a WebAppCompoundAssessmentSummary. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param summaryName Gets the Name of the WebApp compound assessment summary. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WebAppCompoundAssessmentSummary along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String projectName, String compoundAssessmentName, String summaryName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + if (summaryName == null) { + return Mono.error(new IllegalArgumentException("Parameter summaryName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, projectName, compoundAssessmentName, summaryName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a WebAppCompoundAssessmentSummary. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param summaryName Gets the Name of the WebApp compound assessment summary. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WebAppCompoundAssessmentSummary along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String projectName, String compoundAssessmentName, String summaryName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + if (summaryName == null) { + return Mono.error(new IllegalArgumentException("Parameter summaryName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, projectName, compoundAssessmentName, summaryName, accept, context); + } + + /** + * Get a WebAppCompoundAssessmentSummary. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param summaryName Gets the Name of the WebApp compound assessment summary. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WebAppCompoundAssessmentSummary on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String projectName, + String compoundAssessmentName, String summaryName) { + return getWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName, summaryName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a WebAppCompoundAssessmentSummary. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param summaryName Gets the Name of the WebApp compound assessment summary. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WebAppCompoundAssessmentSummary along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, String summaryName, Context context) { + return getWithResponseAsync(resourceGroupName, projectName, compoundAssessmentName, summaryName, context) + .block(); + } + + /** + * Get a WebAppCompoundAssessmentSummary. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param summaryName Gets the Name of the WebApp compound assessment summary. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WebAppCompoundAssessmentSummary. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WebAppCompoundAssessmentSummaryInner get(String resourceGroupName, String projectName, + String compoundAssessmentName, String summaryName) { + return getWithResponse(resourceGroupName, projectName, compoundAssessmentName, summaryName, Context.NONE) + .getValue(); + } + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByParentSinglePageAsync(String resourceGroupName, String projectName, String compoundAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByParent(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, projectName, compoundAssessmentName, accept, + context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentSinglePageAsync( + String resourceGroupName, String projectName, String compoundAssessmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (compoundAssessmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter compoundAssessmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByParent(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, projectName, compoundAssessmentName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByParentAsync(String resourceGroupName, + String projectName, String compoundAssessmentName) { + return new PagedFlux<>( + () -> listByParentSinglePageAsync(resourceGroupName, projectName, compoundAssessmentName), + nextLink -> listByParentNextSinglePageAsync(nextLink)); + } + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByParentAsync(String resourceGroupName, + String projectName, String compoundAssessmentName, Context context) { + return new PagedFlux<>( + () -> listByParentSinglePageAsync(resourceGroupName, projectName, compoundAssessmentName, context), + nextLink -> listByParentNextSinglePageAsync(nextLink, context)); + } + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceGroupName, + String projectName, String compoundAssessmentName) { + return new PagedIterable<>(listByParentAsync(resourceGroupName, projectName, compoundAssessmentName)); + } + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceGroupName, + String projectName, String compoundAssessmentName, Context context) { + return new PagedIterable<>(listByParentAsync(resourceGroupName, projectName, compoundAssessmentName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByParentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByParentNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentSummaryOperationsImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentSummaryOperationsImpl.java new file mode 100644 index 000000000000..d99fe6e35f72 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/CompoundAssessmentSummaryOperationsImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.migrate.fluent.CompoundAssessmentSummaryOperationsClient; +import com.azure.resourcemanager.migrate.fluent.models.WebAppCompoundAssessmentSummaryInner; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentSummaryOperations; +import com.azure.resourcemanager.migrate.models.WebAppCompoundAssessmentSummary; + +public final class CompoundAssessmentSummaryOperationsImpl implements CompoundAssessmentSummaryOperations { + private static final ClientLogger LOGGER = new ClientLogger(CompoundAssessmentSummaryOperationsImpl.class); + + private final CompoundAssessmentSummaryOperationsClient innerClient; + + private final com.azure.resourcemanager.migrate.MigrateManager serviceManager; + + public CompoundAssessmentSummaryOperationsImpl(CompoundAssessmentSummaryOperationsClient innerClient, + com.azure.resourcemanager.migrate.MigrateManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, String summaryName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, projectName, compoundAssessmentName, summaryName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WebAppCompoundAssessmentSummaryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WebAppCompoundAssessmentSummary get(String resourceGroupName, String projectName, + String compoundAssessmentName, String summaryName) { + WebAppCompoundAssessmentSummaryInner inner + = this.serviceClient().get(resourceGroupName, projectName, compoundAssessmentName, summaryName); + if (inner != null) { + return new WebAppCompoundAssessmentSummaryImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByParent(String resourceGroupName, String projectName, + String compoundAssessmentName) { + PagedIterable inner + = this.serviceClient().listByParent(resourceGroupName, projectName, compoundAssessmentName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WebAppCompoundAssessmentSummaryImpl(inner1, this.manager())); + } + + public PagedIterable listByParent(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context) { + PagedIterable inner + = this.serviceClient().listByParent(resourceGroupName, projectName, compoundAssessmentName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WebAppCompoundAssessmentSummaryImpl(inner1, this.manager())); + } + + private CompoundAssessmentSummaryOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.migrate.MigrateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/DownloadUrlImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/DownloadUrlImpl.java new file mode 100644 index 000000000000..e2d60efad493 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/DownloadUrlImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.resourcemanager.migrate.fluent.models.DownloadUrlInner; +import com.azure.resourcemanager.migrate.models.DownloadUrl; +import java.time.OffsetDateTime; + +public final class DownloadUrlImpl implements DownloadUrl { + private DownloadUrlInner innerObject; + + private final com.azure.resourcemanager.migrate.MigrateManager serviceManager; + + DownloadUrlImpl(DownloadUrlInner innerObject, com.azure.resourcemanager.migrate.MigrateManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String assessmentReportUrl() { + return this.innerModel().assessmentReportUrl(); + } + + public OffsetDateTime expirationTime() { + return this.innerModel().expirationTime(); + } + + public DownloadUrlInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.migrate.MigrateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/MigrateClientBuilder.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/MigrateClientBuilder.java new file mode 100644 index 000000000000..f435d263b7ef --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/MigrateClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the MigrateClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { MigrateClientImpl.class }) +public final class MigrateClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the MigrateClientBuilder. + */ + public MigrateClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the MigrateClientBuilder. + */ + public MigrateClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the MigrateClientBuilder. + */ + public MigrateClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the MigrateClientBuilder. + */ + public MigrateClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the MigrateClientBuilder. + */ + public MigrateClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the MigrateClientBuilder. + */ + public MigrateClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MigrateClientImpl with the provided parameters. + * + * @return an instance of MigrateClientImpl. + */ + public MigrateClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + MigrateClientImpl client = new MigrateClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/MigrateClientImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/MigrateClientImpl.java new file mode 100644 index 000000000000..cfcf6b722f4e --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/MigrateClientImpl.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.migrate.fluent.CompoundAssessmentOperationsClient; +import com.azure.resourcemanager.migrate.fluent.CompoundAssessmentSummaryOperationsClient; +import com.azure.resourcemanager.migrate.fluent.MigrateClient; +import com.azure.resourcemanager.migrate.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the MigrateClientImpl type. + */ +@ServiceClient(builder = MigrateClientBuilder.class) +public final class MigrateClientImpl implements MigrateClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The CompoundAssessmentOperationsClient object to access its operations. + */ + private final CompoundAssessmentOperationsClient compoundAssessmentOperations; + + /** + * Gets the CompoundAssessmentOperationsClient object to access its operations. + * + * @return the CompoundAssessmentOperationsClient object. + */ + public CompoundAssessmentOperationsClient getCompoundAssessmentOperations() { + return this.compoundAssessmentOperations; + } + + /** + * The CompoundAssessmentSummaryOperationsClient object to access its operations. + */ + private final CompoundAssessmentSummaryOperationsClient compoundAssessmentSummaryOperations; + + /** + * Gets the CompoundAssessmentSummaryOperationsClient object to access its operations. + * + * @return the CompoundAssessmentSummaryOperationsClient object. + */ + public CompoundAssessmentSummaryOperationsClient getCompoundAssessmentSummaryOperations() { + return this.compoundAssessmentSummaryOperations; + } + + /** + * Initializes an instance of MigrateClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + MigrateClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2024-03-03-preview"; + this.operations = new OperationsClientImpl(this); + this.compoundAssessmentOperations = new CompoundAssessmentOperationsClientImpl(this); + this.compoundAssessmentSummaryOperations = new CompoundAssessmentSummaryOperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MigrateClientImpl.class); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationImpl.java new file mode 100644 index 000000000000..1df845e02264 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.resourcemanager.migrate.fluent.models.OperationInner; +import com.azure.resourcemanager.migrate.models.ActionType; +import com.azure.resourcemanager.migrate.models.Operation; +import com.azure.resourcemanager.migrate.models.OperationDisplay; +import com.azure.resourcemanager.migrate.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.migrate.MigrateManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.migrate.MigrateManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.migrate.MigrateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationsClientImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..cfcdc07a1d09 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.migrate.fluent.OperationsClient; +import com.azure.resourcemanager.migrate.fluent.models.OperationInner; +import com.azure.resourcemanager.migrate.implementation.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final MigrateClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MigrateClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MigrateClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MigrateClientOperati") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Migrate/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationsImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationsImpl.java new file mode 100644 index 000000000000..a3a534387ccc --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.migrate.fluent.OperationsClient; +import com.azure.resourcemanager.migrate.fluent.models.OperationInner; +import com.azure.resourcemanager.migrate.models.Operation; +import com.azure.resourcemanager.migrate.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.migrate.MigrateManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.migrate.MigrateManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.migrate.MigrateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/ResourceManagerUtils.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..8b440adb7d66 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/WebAppCompoundAssessmentSummaryImpl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/WebAppCompoundAssessmentSummaryImpl.java new file mode 100644 index 000000000000..fd1b09ef6cc7 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/WebAppCompoundAssessmentSummaryImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.migrate.fluent.models.WebAppCompoundAssessmentSummaryInner; +import com.azure.resourcemanager.migrate.models.WebAppCompoundAssessmentSummary; +import com.azure.resourcemanager.migrate.models.WebAppCompoundAssessmentSummaryProperties; + +public final class WebAppCompoundAssessmentSummaryImpl implements WebAppCompoundAssessmentSummary { + private WebAppCompoundAssessmentSummaryInner innerObject; + + private final com.azure.resourcemanager.migrate.MigrateManager serviceManager; + + WebAppCompoundAssessmentSummaryImpl(WebAppCompoundAssessmentSummaryInner innerObject, + com.azure.resourcemanager.migrate.MigrateManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public WebAppCompoundAssessmentSummaryProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public WebAppCompoundAssessmentSummaryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.migrate.MigrateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/CompoundAssessmentListResult.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/CompoundAssessmentListResult.java new file mode 100644 index 000000000000..a2022b64a28e --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/CompoundAssessmentListResult.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.migrate.fluent.models.CompoundAssessmentInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CompoundAssessment list operation. + */ +@Immutable +public final class CompoundAssessmentListResult implements JsonSerializable { + /* + * The CompoundAssessment items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of CompoundAssessmentListResult class. + */ + private CompoundAssessmentListResult() { + } + + /** + * Get the value property: The CompoundAssessment items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model CompoundAssessmentListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CompoundAssessmentListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CompoundAssessmentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CompoundAssessmentListResult 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 CompoundAssessmentListResult. + */ + public static CompoundAssessmentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CompoundAssessmentListResult deserializedCompoundAssessmentListResult = new CompoundAssessmentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CompoundAssessmentInner.fromJson(reader1)); + deserializedCompoundAssessmentListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCompoundAssessmentListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCompoundAssessmentListResult; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/OperationListResult.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..516add0218be --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/OperationListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.migrate.fluent.models.OperationInner; +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. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/WebAppCompoundAssessmentSummaryListResult.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/WebAppCompoundAssessmentSummaryListResult.java new file mode 100644 index 000000000000..6ece967d888a --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/models/WebAppCompoundAssessmentSummaryListResult.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.migrate.fluent.models.WebAppCompoundAssessmentSummaryInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a WebAppCompoundAssessmentSummary list operation. + */ +@Immutable +public final class WebAppCompoundAssessmentSummaryListResult + implements JsonSerializable { + /* + * The WebAppCompoundAssessmentSummary items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of WebAppCompoundAssessmentSummaryListResult class. + */ + private WebAppCompoundAssessmentSummaryListResult() { + } + + /** + * Get the value property: The WebAppCompoundAssessmentSummary items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model WebAppCompoundAssessmentSummaryListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WebAppCompoundAssessmentSummaryListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebAppCompoundAssessmentSummaryListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebAppCompoundAssessmentSummaryListResult 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 WebAppCompoundAssessmentSummaryListResult. + */ + public static WebAppCompoundAssessmentSummaryListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebAppCompoundAssessmentSummaryListResult deserializedWebAppCompoundAssessmentSummaryListResult + = new WebAppCompoundAssessmentSummaryListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WebAppCompoundAssessmentSummaryInner.fromJson(reader1)); + deserializedWebAppCompoundAssessmentSummaryListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWebAppCompoundAssessmentSummaryListResult; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/package-info.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/package-info.java new file mode 100644 index 000000000000..e87de4aa145b --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for Migrate. + * Azure Migrate Resource Provider management API. + */ +package com.azure.resourcemanager.migrate.implementation; diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ActionType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ActionType.java new file mode 100644 index 000000000000..ae8b8640415a --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AssessmentSource.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AssessmentSource.java new file mode 100644 index 000000000000..954020143a1d --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AssessmentSource.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Assessment Source. + */ +public final class AssessmentSource extends ExpandableStringEnum { + /** + * Unknown - Assessment Source. + */ + public static final AssessmentSource UNKNOWN = fromString("Unknown"); + + /** + * Machine - Assessment Source. + */ + public static final AssessmentSource MACHINE = fromString("Machine"); + + /** + * IIS - Assessment Source. + */ + public static final AssessmentSource IIS = fromString("IIS"); + + /** + * TomCat - Assessment Source. + */ + public static final AssessmentSource TOM_CAT = fromString("TomCat"); + + /** + * OracleServer - Assessment Source. + */ + public static final AssessmentSource ORACLE_SERVER = fromString("OracleServer"); + + /** + * OracleDatabase - Assessment Source. + */ + public static final AssessmentSource ORACLE_DATABASE = fromString("OracleDatabase"); + + /** + * SAPInstance - Assessment Source. + */ + public static final AssessmentSource SAPINSTANCE = fromString("SAPInstance"); + + /** + * SpringbootApplication - Assessment Source. + */ + public static final AssessmentSource SPRINGBOOT_APPLICATION = fromString("SpringbootApplication"); + + /** + * MySQLServer - Assessment Source. + */ + public static final AssessmentSource MY_SQLSERVER = fromString("MySQLServer"); + + /** + * SqlInstance - Assessment Source. + */ + public static final AssessmentSource SQL_INSTANCE = fromString("SqlInstance"); + + /** + * SqlDatabase - Assessment Source. + */ + public static final AssessmentSource SQL_DATABASE = fromString("SqlDatabase"); + + /** + * WebApps - Assessment Source. + */ + public static final AssessmentSource WEB_APPS = fromString("WebApps"); + + /** + * Creates a new instance of AssessmentSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AssessmentSource() { + } + + /** + * Creates or finds a AssessmentSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding AssessmentSource. + */ + public static AssessmentSource fromString(String name) { + return fromString(name, AssessmentSource.class); + } + + /** + * Gets known AssessmentSource values. + * + * @return known AssessmentSource values. + */ + public static Collection values() { + return values(AssessmentSource.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AssessmentStatus.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AssessmentStatus.java new file mode 100644 index 000000000000..b2b76b184cdc --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AssessmentStatus.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Assessment Status. + */ +public final class AssessmentStatus extends ExpandableStringEnum { + /** + * Assessment is Created. + */ + public static final AssessmentStatus CREATED = fromString("Created"); + + /** + * Assessment is Updated. + */ + public static final AssessmentStatus UPDATED = fromString("Updated"); + + /** + * Assessment is currently running. + */ + public static final AssessmentStatus RUNNING = fromString("Running"); + + /** + * Assessment is Completed or Ready. + */ + public static final AssessmentStatus COMPLETED = fromString("Completed"); + + /** + * Assessment is Failed i.e. it is now invalid. + */ + public static final AssessmentStatus INVALID = fromString("Invalid"); + + /** + * Assessment is Out of Sync. + */ + public static final AssessmentStatus OUT_OF_SYNC = fromString("OutOfSync"); + + /** + * Assessment is Out Dated. + */ + public static final AssessmentStatus OUT_DATED = fromString("OutDated"); + + /** + * Assessment is Deleted. + */ + public static final AssessmentStatus DELETED = fromString("Deleted"); + + /** + * Assessment has Failed. + */ + public static final AssessmentStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of AssessmentStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AssessmentStatus() { + } + + /** + * Creates or finds a AssessmentStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding AssessmentStatus. + */ + public static AssessmentStatus fromString(String name) { + return fromString(name, AssessmentStatus.class); + } + + /** + * Gets known AssessmentStatus values. + * + * @return known AssessmentStatus values. + */ + public static Collection values() { + return values(AssessmentStatus.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AzureManagementOfferingType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AzureManagementOfferingType.java new file mode 100644 index 000000000000..9d25ef4fbd84 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AzureManagementOfferingType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Azure management Offering type. + */ +public final class AzureManagementOfferingType extends ExpandableStringEnum { + /** + * No - Azure management Offering type. + */ + public static final AzureManagementOfferingType NO = fromString("No"); + + /** + * SCOMMI - Azure management Offering type. + */ + public static final AzureManagementOfferingType SCOMMI = fromString("SCOMMI"); + + /** + * AzMon - Azure management Offering type. + */ + public static final AzureManagementOfferingType AZ_MON = fromString("AzMon"); + + /** + * AUM - Azure management Offering type. + */ + public static final AzureManagementOfferingType AUM = fromString("AUM"); + + /** + * AzureBackup - Azure management Offering type. + */ + public static final AzureManagementOfferingType AZURE_BACKUP = fromString("AzureBackup"); + + /** + * Creates a new instance of AzureManagementOfferingType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AzureManagementOfferingType() { + } + + /** + * Creates or finds a AzureManagementOfferingType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureManagementOfferingType. + */ + public static AzureManagementOfferingType fromString(String name) { + return fromString(name, AzureManagementOfferingType.class); + } + + /** + * Gets known AzureManagementOfferingType values. + * + * @return known AzureManagementOfferingType values. + */ + public static Collection values() { + return values(AzureManagementOfferingType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AzureTarget.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AzureTarget.java new file mode 100644 index 000000000000..748c3b18062e --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/AzureTarget.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Azure Target. + */ +public final class AzureTarget extends ExpandableStringEnum { + /** + * Unknown - Azure Target. + */ + public static final AzureTarget UNKNOWN = fromString("Unknown"); + + /** + * SqlDatabase - Azure Target. + */ + public static final AzureTarget SQL_DATABASE = fromString("SqlDatabase"); + + /** + * SqlMI - Azure Target. + */ + public static final AzureTarget SQL_MI = fromString("SqlMI"); + + /** + * FlexServerPG - Azure Target. + */ + public static final AzureTarget FLEX_SERVER_PG = fromString("FlexServerPG"); + + /** + * OracleIaasVM - Azure Target. + */ + public static final AzureTarget ORACLE_IAAS_VM = fromString("OracleIaasVM"); + + /** + * AzureSpringApps - Azure Target. + */ + public static final AzureTarget AZURE_SPRING_APPS = fromString("AzureSpringApps"); + + /** + * SAPAzureInstance - Azure Target. + */ + public static final AzureTarget SAPAZURE_INSTANCE = fromString("SAPAzureInstance"); + + /** + * AKS - Azure Target. + */ + public static final AzureTarget AKS = fromString("AKS"); + + /** + * MySQLAzureFlexServer - Azure Target. + */ + public static final AzureTarget MY_SQLAZURE_FLEX_SERVER = fromString("MySQLAzureFlexServer"); + + /** + * AzureSQLVM - Azure Target. + */ + public static final AzureTarget AZURE_SQLVM = fromString("AzureSQLVM"); + + /** + * AzureVM - Azure Target. + */ + public static final AzureTarget AZURE_VM = fromString("AzureVM"); + + /** + * AzureAppService - Azure Target. + */ + public static final AzureTarget AZURE_APP_SERVICE = fromString("AzureAppService"); + + /** + * AzureAppServiceContainer - Azure Target. + */ + public static final AzureTarget AZURE_APP_SERVICE_CONTAINER = fromString("AzureAppServiceContainer"); + + /** + * Avs - Azure Target. + */ + public static final AzureTarget AVS = fromString("Avs"); + + /** + * Creates a new instance of AzureTarget value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AzureTarget() { + } + + /** + * Creates or finds a AzureTarget from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureTarget. + */ + public static AzureTarget fromString(String name) { + return fromString(name, AzureTarget.class); + } + + /** + * Gets known AzureTarget values. + * + * @return known AzureTarget values. + */ + public static Collection values() { + return values(AzureTarget.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CloudSuitabilityCommon.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CloudSuitabilityCommon.java new file mode 100644 index 000000000000..9d2545fa8f49 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CloudSuitabilityCommon.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Cloud Suitability Common. + */ +public final class CloudSuitabilityCommon extends ExpandableStringEnum { + /** + * Unknown - Cloud Suitability Common. + */ + public static final CloudSuitabilityCommon UNKNOWN = fromString("Unknown"); + + /** + * NotSuitable - Cloud Suitability Common. + */ + public static final CloudSuitabilityCommon NOT_SUITABLE = fromString("NotSuitable"); + + /** + * Suitable - Cloud Suitability Common. + */ + public static final CloudSuitabilityCommon SUITABLE = fromString("Suitable"); + + /** + * ConditionallySuitable - Cloud Suitability Common. + */ + public static final CloudSuitabilityCommon CONDITIONALLY_SUITABLE = fromString("ConditionallySuitable"); + + /** + * ReadinessUnknown - Cloud Suitability Common. + */ + public static final CloudSuitabilityCommon READINESS_UNKNOWN = fromString("ReadinessUnknown"); + + /** + * SuitableWithWarnings - Cloud Suitability Common. + */ + public static final CloudSuitabilityCommon SUITABLE_WITH_WARNINGS = fromString("SuitableWithWarnings"); + + /** + * Creates a new instance of CloudSuitabilityCommon value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CloudSuitabilityCommon() { + } + + /** + * Creates or finds a CloudSuitabilityCommon from its string representation. + * + * @param name a name to look for. + * @return the corresponding CloudSuitabilityCommon. + */ + public static CloudSuitabilityCommon fromString(String name) { + return fromString(name, CloudSuitabilityCommon.class); + } + + /** + * Gets known CloudSuitabilityCommon values. + * + * @return known CloudSuitabilityCommon values. + */ + public static Collection values() { + return values(CloudSuitabilityCommon.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessment.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessment.java new file mode 100644 index 000000000000..ff9f92916d23 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessment.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.migrate.fluent.models.CompoundAssessmentInner; + +/** + * An immutable client-side representation of CompoundAssessment. + */ +public interface CompoundAssessment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + CompoundAssessmentProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.migrate.fluent.models.CompoundAssessmentInner object. + * + * @return the inner object. + */ + CompoundAssessmentInner innerModel(); + + /** + * The entirety of the CompoundAssessment definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The CompoundAssessment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CompoundAssessment definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the CompoundAssessment definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, projectName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @return the next definition stage. + */ + WithCreate withExistingAssessmentProject(String resourceGroupName, String projectName); + } + + /** + * The stage of the CompoundAssessment definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + CompoundAssessment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CompoundAssessment create(Context context); + } + + /** + * The stage of the CompoundAssessment definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(CompoundAssessmentProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CompoundAssessment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CompoundAssessment refresh(Context context); + + /** + * A long-running resource action. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + DownloadUrl downloadUrl(DownloadUrlRequest body); + + /** + * A long-running resource action. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + DownloadUrl downloadUrl(DownloadUrlRequest body, Context context); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentDetails.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentDetails.java new file mode 100644 index 000000000000..a27708634b83 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentDetails.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Details of the compound assessment. + */ +@Immutable +public final class CompoundAssessmentDetails implements JsonSerializable { + /* + * Timestamp when the assessment was created. + */ + private OffsetDateTime createdTimestamp; + + /* + * Timestamp when the assessment was last updated. + */ + private OffsetDateTime updatedTimestamp; + + /* + * Status of the assessment. + */ + private AssessmentStatus status; + + /** + * Creates an instance of CompoundAssessmentDetails class. + */ + private CompoundAssessmentDetails() { + } + + /** + * Get the createdTimestamp property: Timestamp when the assessment was created. + * + * @return the createdTimestamp value. + */ + public OffsetDateTime createdTimestamp() { + return this.createdTimestamp; + } + + /** + * Get the updatedTimestamp property: Timestamp when the assessment was last updated. + * + * @return the updatedTimestamp value. + */ + public OffsetDateTime updatedTimestamp() { + return this.updatedTimestamp; + } + + /** + * Get the status property: Status of the assessment. + * + * @return the status value. + */ + public AssessmentStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property status in model CompoundAssessmentDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CompoundAssessmentDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("createdTimestamp", + this.createdTimestamp == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdTimestamp)); + jsonWriter.writeStringField("updatedTimestamp", + this.updatedTimestamp == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.updatedTimestamp)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CompoundAssessmentDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CompoundAssessmentDetails 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 CompoundAssessmentDetails. + */ + public static CompoundAssessmentDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CompoundAssessmentDetails deserializedCompoundAssessmentDetails = new CompoundAssessmentDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedCompoundAssessmentDetails.status = AssessmentStatus.fromString(reader.getString()); + } else if ("createdTimestamp".equals(fieldName)) { + deserializedCompoundAssessmentDetails.createdTimestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("updatedTimestamp".equals(fieldName)) { + deserializedCompoundAssessmentDetails.updatedTimestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedCompoundAssessmentDetails; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentOperations.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentOperations.java new file mode 100644 index 000000000000..46b0620d2968 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentOperations.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CompoundAssessmentOperations. + */ +public interface CompoundAssessmentOperations { + /** + * Get a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context); + + /** + * Get a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment. + */ + CompoundAssessment get(String resourceGroupName, String projectName, String compoundAssessmentName); + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceGroupName, String projectName); + + /** + * List CompoundAssessment resources by AssessmentProject. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CompoundAssessment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceGroupName, String projectName, Context context); + + /** + * Delete a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String projectName, String compoundAssessmentName, + Context context); + + /** + * Delete a CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String projectName, String compoundAssessmentName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + DownloadUrl downloadUrl(String resourceGroupName, String projectName, String compoundAssessmentName, + DownloadUrlRequest body); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + DownloadUrl downloadUrl(String resourceGroupName, String projectName, String compoundAssessmentName, + DownloadUrlRequest body, Context context); + + /** + * Get a CompoundAssessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment along with {@link Response}. + */ + CompoundAssessment getById(String id); + + /** + * Get a CompoundAssessment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CompoundAssessment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a CompoundAssessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a CompoundAssessment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CompoundAssessment resource. + * + * @param name resource name. + * @return the first stage of the new CompoundAssessment definition. + */ + CompoundAssessment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentProperties.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentProperties.java new file mode 100644 index 000000000000..88f143928cec --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentProperties.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of a compound assessment. + */ +@Fluent +public final class CompoundAssessmentProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * ARM IDs of the target assessments. + */ + private TargetAssessmentArmIds targetAssessmentArmIds; + + /* + * Fallback machine assessment ARM ID. + */ + private String fallbackMachineAssessmentArmId; + + /* + * Details of the compound assessment. + */ + private CompoundAssessmentDetails details; + + /** + * Creates an instance of CompoundAssessmentProperties class. + */ + public CompoundAssessmentProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the targetAssessmentArmIds property: ARM IDs of the target assessments. + * + * @return the targetAssessmentArmIds value. + */ + public TargetAssessmentArmIds targetAssessmentArmIds() { + return this.targetAssessmentArmIds; + } + + /** + * Set the targetAssessmentArmIds property: ARM IDs of the target assessments. + * + * @param targetAssessmentArmIds the targetAssessmentArmIds value to set. + * @return the CompoundAssessmentProperties object itself. + */ + public CompoundAssessmentProperties withTargetAssessmentArmIds(TargetAssessmentArmIds targetAssessmentArmIds) { + this.targetAssessmentArmIds = targetAssessmentArmIds; + return this; + } + + /** + * Get the fallbackMachineAssessmentArmId property: Fallback machine assessment ARM ID. + * + * @return the fallbackMachineAssessmentArmId value. + */ + public String fallbackMachineAssessmentArmId() { + return this.fallbackMachineAssessmentArmId; + } + + /** + * Set the fallbackMachineAssessmentArmId property: Fallback machine assessment ARM ID. + * + * @param fallbackMachineAssessmentArmId the fallbackMachineAssessmentArmId value to set. + * @return the CompoundAssessmentProperties object itself. + */ + public CompoundAssessmentProperties withFallbackMachineAssessmentArmId(String fallbackMachineAssessmentArmId) { + this.fallbackMachineAssessmentArmId = fallbackMachineAssessmentArmId; + return this; + } + + /** + * Get the details property: Details of the compound assessment. + * + * @return the details value. + */ + public CompoundAssessmentDetails details() { + return this.details; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetAssessmentArmIds() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property targetAssessmentArmIds in model CompoundAssessmentProperties")); + } else { + targetAssessmentArmIds().validate(); + } + if (details() != null) { + details().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CompoundAssessmentProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("targetAssessmentArmIds", this.targetAssessmentArmIds); + jsonWriter.writeStringField("fallbackMachineAssessmentArmId", this.fallbackMachineAssessmentArmId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CompoundAssessmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CompoundAssessmentProperties 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 CompoundAssessmentProperties. + */ + public static CompoundAssessmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CompoundAssessmentProperties deserializedCompoundAssessmentProperties = new CompoundAssessmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetAssessmentArmIds".equals(fieldName)) { + deserializedCompoundAssessmentProperties.targetAssessmentArmIds + = TargetAssessmentArmIds.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedCompoundAssessmentProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("fallbackMachineAssessmentArmId".equals(fieldName)) { + deserializedCompoundAssessmentProperties.fallbackMachineAssessmentArmId = reader.getString(); + } else if ("details".equals(fieldName)) { + deserializedCompoundAssessmentProperties.details = CompoundAssessmentDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCompoundAssessmentProperties; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentSummaryOperations.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentSummaryOperations.java new file mode 100644 index 000000000000..828b5e6918c4 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CompoundAssessmentSummaryOperations.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CompoundAssessmentSummaryOperations. + */ +public interface CompoundAssessmentSummaryOperations { + /** + * Get a WebAppCompoundAssessmentSummary. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param summaryName Gets the Name of the WebApp compound assessment summary. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WebAppCompoundAssessmentSummary along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String projectName, + String compoundAssessmentName, String summaryName, Context context); + + /** + * Get a WebAppCompoundAssessmentSummary. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param summaryName Gets the Name of the WebApp compound assessment summary. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WebAppCompoundAssessmentSummary. + */ + WebAppCompoundAssessmentSummary get(String resourceGroupName, String projectName, String compoundAssessmentName, + String summaryName); + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceGroupName, String projectName, + String compoundAssessmentName); + + /** + * List WebAppCompoundAssessmentSummary resources by CompoundAssessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param projectName Assessment Project Name. + * @param compoundAssessmentName Compound Assessment ARM name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WebAppCompoundAssessmentSummary list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceGroupName, String projectName, + String compoundAssessmentName, Context context); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CostDetailsCommon.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CostDetailsCommon.java new file mode 100644 index 000000000000..e8a1e2461142 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CostDetailsCommon.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; +import java.util.List; + +/** + * The cost details. + */ +@Immutable +public final class CostDetailsCommon implements JsonSerializable { + /* + * The savings options. + */ + private SavingsOptions savingOptions; + + /* + * The sku cost details per azure offer type. + */ + private List costDetail; + + /** + * Creates an instance of CostDetailsCommon class. + */ + private CostDetailsCommon() { + } + + /** + * Get the savingOptions property: The savings options. + * + * @return the savingOptions value. + */ + public SavingsOptions savingOptions() { + return this.savingOptions; + } + + /** + * Get the costDetail property: The sku cost details per azure offer type. + * + * @return the costDetail value. + */ + public List costDetail() { + return this.costDetail; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (costDetail() != null) { + costDetail().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CostDetailsCommon from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CostDetailsCommon 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 CostDetailsCommon. + */ + public static CostDetailsCommon fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CostDetailsCommon deserializedCostDetailsCommon = new CostDetailsCommon(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("savingOptions".equals(fieldName)) { + deserializedCostDetailsCommon.savingOptions = SavingsOptions.fromString(reader.getString()); + } else if ("costDetail".equals(fieldName)) { + List costDetail + = reader.readArray(reader1 -> NameValuePairCostType.fromJson(reader1)); + deserializedCostDetailsCommon.costDetail = costDetail; + } else { + reader.skipChildren(); + } + } + + return deserializedCostDetailsCommon; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CostType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CostType.java new file mode 100644 index 000000000000..58ff63b8b3a5 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/CostType.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Cost type. + */ +public final class CostType extends ExpandableStringEnum { + /** + * MonthlyStorageCost - Cost type. + */ + public static final CostType MONTHLY_STORAGE_COST = fromString("MonthlyStorageCost"); + + /** + * MonthlyComputeCost - Cost type. + */ + public static final CostType MONTHLY_COMPUTE_COST = fromString("MonthlyComputeCost"); + + /** + * MonthlyLicensingCost - Cost type. + */ + public static final CostType MONTHLY_LICENSING_COST = fromString("MonthlyLicensingCost"); + + /** + * MonthlySecurityCost - Cost type. + */ + public static final CostType MONTHLY_SECURITY_COST = fromString("MonthlySecurityCost"); + + /** + * MonthlyManagementCost - Cost type. + */ + public static final CostType MONTHLY_MANAGEMENT_COST = fromString("MonthlyManagementCost"); + + /** + * MonitoringService - Cost type. + */ + public static final CostType MONITORING_SERVICE = fromString("MonitoringService"); + + /** + * DataProtectionService - Cost type. + */ + public static final CostType DATA_PROTECTION_SERVICE = fromString("DataProtectionService"); + + /** + * PatchingService - Cost type. + */ + public static final CostType PATCHING_SERVICE = fromString("PatchingService"); + + /** + * MonthlyAzureHybridCost - Cost type. + */ + public static final CostType MONTHLY_AZURE_HYBRID_COST = fromString("MonthlyAzureHybridCost"); + + /** + * MonthlyPremiumV2StorageCost - Cost type. + */ + public static final CostType MONTHLY_PREMIUM_V2STORAGE_COST = fromString("MonthlyPremiumV2StorageCost"); + + /** + * MonthlyLinuxAzureHybridCost - Cost type. + */ + public static final CostType MONTHLY_LINUX_AZURE_HYBRID_COST = fromString("MonthlyLinuxAzureHybridCost"); + + /** + * MonthlyUltraStorageCost - Cost type. + */ + public static final CostType MONTHLY_ULTRA_STORAGE_COST = fromString("MonthlyUltraStorageCost"); + + /** + * MonthlyStandardSsdStorageCost - Cost type. + */ + public static final CostType MONTHLY_STANDARD_SSD_STORAGE_COST = fromString("MonthlyStandardSsdStorageCost"); + + /** + * MonthlyBandwidthCost - Cost type. + */ + public static final CostType MONTHLY_BANDWIDTH_COST = fromString("MonthlyBandwidthCost"); + + /** + * MonthlyPremiumStorageCost - Cost type. + */ + public static final CostType MONTHLY_PREMIUM_STORAGE_COST = fromString("MonthlyPremiumStorageCost"); + + /** + * MonthlyUltraDiskCost - Cost type. + */ + public static final CostType MONTHLY_ULTRA_DISK_COST = fromString("MonthlyUltraDiskCost"); + + /** + * MonthlyStandardHddStorageCost - Cost type. + */ + public static final CostType MONTHLY_STANDARD_HDD_STORAGE_COST = fromString("MonthlyStandardHddStorageCost"); + + /** + * MonthlyAvsExternalStorageCost - Cost type. + */ + public static final CostType MONTHLY_AVS_EXTERNAL_STORAGE_COST = fromString("MonthlyAvsExternalStorageCost"); + + /** + * MonthlyAvsNetworkCost - Cost type. + */ + public static final CostType MONTHLY_AVS_NETWORK_COST = fromString("MonthlyAvsNetworkCost"); + + /** + * MonthlyAvsNodeCost - Cost type. + */ + public static final CostType MONTHLY_AVS_NODE_COST = fromString("MonthlyAvsNodeCost"); + + /** + * TotalMonthlyCost - Cost type. + */ + public static final CostType TOTAL_MONTHLY_COST = fromString("TotalMonthlyCost"); + + /** + * Creates a new instance of CostType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CostType() { + } + + /** + * Creates or finds a CostType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CostType. + */ + public static CostType fromString(String name) { + return fromString(name, CostType.class); + } + + /** + * Gets known CostType values. + * + * @return known CostType values. + */ + public static Collection values() { + return values(CostType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DiscoveredLightSummary.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DiscoveredLightSummary.java new file mode 100644 index 000000000000..2294cc3aa738 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DiscoveredLightSummary.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; +import java.util.List; + +/** + * Summary of the compound assessment. + */ +@Immutable +public final class DiscoveredLightSummary implements JsonSerializable { + /* + * Number of web apps. + */ + private int numberOfWebApps; + + /* + * Number of web apps per type. + */ + private List numberOfWebAppsPerType; + + /* + * Number of web servers per type. + */ + private List numberOfWebServersPerType; + + /* + * Number of web servers. + */ + private int numberOfWebServers; + + /* + * Number of servers. + */ + private int numberOfServers; + + /** + * Creates an instance of DiscoveredLightSummary class. + */ + private DiscoveredLightSummary() { + } + + /** + * Get the numberOfWebApps property: Number of web apps. + * + * @return the numberOfWebApps value. + */ + public int numberOfWebApps() { + return this.numberOfWebApps; + } + + /** + * Get the numberOfWebAppsPerType property: Number of web apps per type. + * + * @return the numberOfWebAppsPerType value. + */ + public List numberOfWebAppsPerType() { + return this.numberOfWebAppsPerType; + } + + /** + * Get the numberOfWebServersPerType property: Number of web servers per type. + * + * @return the numberOfWebServersPerType value. + */ + public List numberOfWebServersPerType() { + return this.numberOfWebServersPerType; + } + + /** + * Get the numberOfWebServers property: Number of web servers. + * + * @return the numberOfWebServers value. + */ + public int numberOfWebServers() { + return this.numberOfWebServers; + } + + /** + * Get the numberOfServers property: Number of servers. + * + * @return the numberOfServers value. + */ + public int numberOfServers() { + return this.numberOfServers; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (numberOfWebAppsPerType() != null) { + numberOfWebAppsPerType().forEach(e -> e.validate()); + } + if (numberOfWebServersPerType() != null) { + numberOfWebServersPerType().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("numberOfWebApps", this.numberOfWebApps); + jsonWriter.writeIntField("numberOfWebServers", this.numberOfWebServers); + jsonWriter.writeIntField("numberOfServers", this.numberOfServers); + jsonWriter.writeArrayField("numberOfWebAppsPerType", this.numberOfWebAppsPerType, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("numberOfWebServersPerType", this.numberOfWebServersPerType, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredLightSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredLightSummary 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 DiscoveredLightSummary. + */ + public static DiscoveredLightSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredLightSummary deserializedDiscoveredLightSummary = new DiscoveredLightSummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("numberOfWebApps".equals(fieldName)) { + deserializedDiscoveredLightSummary.numberOfWebApps = reader.getInt(); + } else if ("numberOfWebServers".equals(fieldName)) { + deserializedDiscoveredLightSummary.numberOfWebServers = reader.getInt(); + } else if ("numberOfServers".equals(fieldName)) { + deserializedDiscoveredLightSummary.numberOfServers = reader.getInt(); + } else if ("numberOfWebAppsPerType".equals(fieldName)) { + List numberOfWebAppsPerType + = reader.readArray(reader1 -> WebAppsPerType.fromJson(reader1)); + deserializedDiscoveredLightSummary.numberOfWebAppsPerType = numberOfWebAppsPerType; + } else if ("numberOfWebServersPerType".equals(fieldName)) { + List numberOfWebServersPerType + = reader.readArray(reader1 -> WebServersPerType.fromJson(reader1)); + deserializedDiscoveredLightSummary.numberOfWebServersPerType = numberOfWebServersPerType; + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredLightSummary; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DownloadUrl.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DownloadUrl.java new file mode 100644 index 000000000000..488e364e5920 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DownloadUrl.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.resourcemanager.migrate.fluent.models.DownloadUrlInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of DownloadUrl. + */ +public interface DownloadUrl { + /** + * Gets the assessmentReportUrl property: Hyperlink to download report. + * + * @return the assessmentReportUrl value. + */ + String assessmentReportUrl(); + + /** + * Gets the expirationTime property: Expiry date of download url. + * + * @return the expirationTime value. + */ + OffsetDateTime expirationTime(); + + /** + * Gets the inner com.azure.resourcemanager.migrate.fluent.models.DownloadUrlInner object. + * + * @return the inner object. + */ + DownloadUrlInner innerModel(); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DownloadUrlRequest.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DownloadUrlRequest.java new file mode 100644 index 000000000000..a3ccdb5ed156 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/DownloadUrlRequest.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; + +/** + * The DownloadUrlRequest model. + */ +@Immutable +public final class DownloadUrlRequest implements JsonSerializable { + /** + * Creates an instance of DownloadUrlRequest class. + */ + public DownloadUrlRequest() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DownloadUrlRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DownloadUrlRequest 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 DownloadUrlRequest. + */ + public static DownloadUrlRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DownloadUrlRequest deserializedDownloadUrlRequest = new DownloadUrlRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedDownloadUrlRequest; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ManagementDetails.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ManagementDetails.java new file mode 100644 index 000000000000..6adda471800e --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ManagementDetails.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; +import java.util.List; + +/** + * Management details. + */ +@Immutable +public final class ManagementDetails implements JsonSerializable { + /* + * The management summary name. + */ + private AzureManagementOfferingType name; + + /* + * The management suitability summary. + */ + private List readinessSummary; + + /** + * Creates an instance of ManagementDetails class. + */ + private ManagementDetails() { + } + + /** + * Get the name property: The management summary name. + * + * @return the name value. + */ + public AzureManagementOfferingType name() { + return this.name; + } + + /** + * Get the readinessSummary property: The management suitability summary. + * + * @return the readinessSummary value. + */ + public List readinessSummary() { + return this.readinessSummary; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (readinessSummary() != null) { + readinessSummary().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagementDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagementDetails 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 ManagementDetails. + */ + public static ManagementDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagementDetails deserializedManagementDetails = new ManagementDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedManagementDetails.name = AzureManagementOfferingType.fromString(reader.getString()); + } else if ("readinessSummary".equals(fieldName)) { + List readinessSummary + = reader.readArray(reader1 -> NameValuePairCloudSuitabilityCommon.fromJson(reader1)); + deserializedManagementDetails.readinessSummary = readinessSummary; + } else { + reader.skipChildren(); + } + } + + return deserializedManagementDetails; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrateWorkloadType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrateWorkloadType.java new file mode 100644 index 000000000000..e13364e1e08e --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrateWorkloadType.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Migration Workload type. + */ +public final class MigrateWorkloadType extends ExpandableStringEnum { + /** + * Unknown - Migration Workload type. + */ + public static final MigrateWorkloadType UNKNOWN = fromString("Unknown"); + + /** + * Machine - Migration Workload type. + */ + public static final MigrateWorkloadType MACHINE = fromString("Machine"); + + /** + * Server - Migration Workload type. + */ + public static final MigrateWorkloadType SERVER = fromString("Server"); + + /** + * Instance - Migration Workload type. + */ + public static final MigrateWorkloadType INSTANCE = fromString("Instance"); + + /** + * WebServer - Migration Workload type. + */ + public static final MigrateWorkloadType WEB_SERVER = fromString("WebServer"); + + /** + * WebApplication - Migration Workload type. + */ + public static final MigrateWorkloadType WEB_APPLICATION = fromString("WebApplication"); + + /** + * Database - Migration Workload type. + */ + public static final MigrateWorkloadType DATABASE = fromString("Database"); + + /** + * Host - Migration Workload type. + */ + public static final MigrateWorkloadType HOST = fromString("Host"); + + /** + * ManagementServer - Migration Workload type. + */ + public static final MigrateWorkloadType MANAGEMENT_SERVER = fromString("ManagementServer"); + + /** + * Creates a new instance of MigrateWorkloadType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrateWorkloadType() { + } + + /** + * Creates or finds a MigrateWorkloadType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrateWorkloadType. + */ + public static MigrateWorkloadType fromString(String name) { + return fromString(name, MigrateWorkloadType.class); + } + + /** + * Gets known MigrateWorkloadType values. + * + * @return known MigrateWorkloadType values. + */ + public static Collection values() { + return values(MigrateWorkloadType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationDetails.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationDetails.java new file mode 100644 index 000000000000..5cde63afa126 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationDetails.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; +import java.util.List; + +/** + * Migration details. + */ +@Immutable +public final class MigrationDetails implements JsonSerializable { + /* + * The readiness summary. + */ + private List readinessSummary; + + /* + * The migration type + */ + private MigrationType migrationType; + + /** + * Creates an instance of MigrationDetails class. + */ + private MigrationDetails() { + } + + /** + * Get the readinessSummary property: The readiness summary. + * + * @return the readinessSummary value. + */ + public List readinessSummary() { + return this.readinessSummary; + } + + /** + * Get the migrationType property: The migration type. + * + * @return the migrationType value. + */ + public MigrationType migrationType() { + return this.migrationType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (readinessSummary() != null) { + readinessSummary().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MigrationDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MigrationDetails 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 MigrationDetails. + */ + public static MigrationDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MigrationDetails deserializedMigrationDetails = new MigrationDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("readinessSummary".equals(fieldName)) { + List readinessSummary + = reader.readArray(reader1 -> NameValuePairCloudSuitabilityCommon.fromJson(reader1)); + deserializedMigrationDetails.readinessSummary = readinessSummary; + } else if ("migrationType".equals(fieldName)) { + deserializedMigrationDetails.migrationType = MigrationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMigrationDetails; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationPlatform.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationPlatform.java new file mode 100644 index 000000000000..32cd1ec71561 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationPlatform.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Migration Platform. + */ +public final class MigrationPlatform extends ExpandableStringEnum { + /** + * Unknown - Migration Platform. + */ + public static final MigrationPlatform UNKNOWN = fromString("Unknown"); + + /** + * PaaS - Migration Platform. + */ + public static final MigrationPlatform PAAS = fromString("PaaS"); + + /** + * IaaS - Migration Platform. + */ + public static final MigrationPlatform IAAS = fromString("IaaS"); + + /** + * SaaS - Migration Platform. + */ + public static final MigrationPlatform SAAS = fromString("SaaS"); + + /** + * Creates a new instance of MigrationPlatform value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrationPlatform() { + } + + /** + * Creates or finds a MigrationPlatform from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrationPlatform. + */ + public static MigrationPlatform fromString(String name) { + return fromString(name, MigrationPlatform.class); + } + + /** + * Gets known MigrationPlatform values. + * + * @return known MigrationPlatform values. + */ + public static Collection values() { + return values(MigrationPlatform.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationType.java new file mode 100644 index 000000000000..224fb148b483 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/MigrationType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Migration Type. + */ +public final class MigrationType extends ExpandableStringEnum { + /** + * Unknown - Migration Type. + */ + public static final MigrationType UNKNOWN = fromString("Unknown"); + + /** + * Replatform - Migration Type. + */ + public static final MigrationType REPLATFORM = fromString("Replatform"); + + /** + * Rehost - Migration Type. + */ + public static final MigrationType REHOST = fromString("Rehost"); + + /** + * Retain - Migration Type. + */ + public static final MigrationType RETAIN = fromString("Retain"); + + /** + * Rearchitect - Migration Type. + */ + public static final MigrationType REARCHITECT = fromString("Rearchitect"); + + /** + * Creates a new instance of MigrationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrationType() { + } + + /** + * Creates or finds a MigrationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrationType. + */ + public static MigrationType fromString(String name) { + return fromString(name, MigrationType.class); + } + + /** + * Gets known MigrationType values. + * + * @return known MigrationType values. + */ + public static Collection values() { + return values(MigrationType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairCloudSuitabilityCommon.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairCloudSuitabilityCommon.java new file mode 100644 index 000000000000..2d58f7a61607 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairCloudSuitabilityCommon.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; + +/** + * The generic name value pair. + */ +@Immutable +public final class NameValuePairCloudSuitabilityCommon + implements JsonSerializable { + /* + * The name. + */ + private CloudSuitabilityCommon name; + + /* + * The value. + */ + private Integer value; + + /** + * Creates an instance of NameValuePairCloudSuitabilityCommon class. + */ + private NameValuePairCloudSuitabilityCommon() { + } + + /** + * Get the name property: The name. + * + * @return the name value. + */ + public CloudSuitabilityCommon name() { + return this.name; + } + + /** + * Get the value property: The value. + * + * @return the value value. + */ + public Integer value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NameValuePairCloudSuitabilityCommon from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NameValuePairCloudSuitabilityCommon 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 NameValuePairCloudSuitabilityCommon. + */ + public static NameValuePairCloudSuitabilityCommon fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NameValuePairCloudSuitabilityCommon deserializedNameValuePairCloudSuitabilityCommon + = new NameValuePairCloudSuitabilityCommon(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedNameValuePairCloudSuitabilityCommon.name + = CloudSuitabilityCommon.fromString(reader.getString()); + } else if ("value".equals(fieldName)) { + deserializedNameValuePairCloudSuitabilityCommon.value = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedNameValuePairCloudSuitabilityCommon; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairCostType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairCostType.java new file mode 100644 index 000000000000..076c1b618916 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairCostType.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; + +/** + * The generic name value pair. + */ +@Immutable +public final class NameValuePairCostType implements JsonSerializable { + /* + * The name. + */ + private CostType name; + + /* + * The value. + */ + private Double value; + + /** + * Creates an instance of NameValuePairCostType class. + */ + private NameValuePairCostType() { + } + + /** + * Get the name property: The name. + * + * @return the name value. + */ + public CostType name() { + return this.name; + } + + /** + * Get the value property: The value. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NameValuePairCostType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NameValuePairCostType 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 NameValuePairCostType. + */ + public static NameValuePairCostType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NameValuePairCostType deserializedNameValuePairCostType = new NameValuePairCostType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedNameValuePairCostType.name = CostType.fromString(reader.getString()); + } else if ("value".equals(fieldName)) { + deserializedNameValuePairCostType.value = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedNameValuePairCostType; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairSavingsType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairSavingsType.java new file mode 100644 index 000000000000..8079a262716b --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/NameValuePairSavingsType.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; + +/** + * The generic name value pair. + */ +@Immutable +public final class NameValuePairSavingsType implements JsonSerializable { + /* + * The name. + */ + private SavingsType name; + + /* + * The value. + */ + private Double value; + + /** + * Creates an instance of NameValuePairSavingsType class. + */ + private NameValuePairSavingsType() { + } + + /** + * Get the name property: The name. + * + * @return the name value. + */ + public SavingsType name() { + return this.name; + } + + /** + * Get the value property: The value. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NameValuePairSavingsType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NameValuePairSavingsType 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 NameValuePairSavingsType. + */ + public static NameValuePairSavingsType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NameValuePairSavingsType deserializedNameValuePairSavingsType = new NameValuePairSavingsType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedNameValuePairSavingsType.name = SavingsType.fromString(reader.getString()); + } else if ("value".equals(fieldName)) { + deserializedNameValuePairSavingsType.value = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedNameValuePairSavingsType; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Operation.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Operation.java new file mode 100644 index 000000000000..c541d46c08f5 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.resourcemanager.migrate.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.migrate.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/OperationDisplay.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/OperationDisplay.java new file mode 100644 index 000000000000..8f4ee02055c1 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; + +/** + * Localized display information for and operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + 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/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Operations.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Operations.java new file mode 100644 index 000000000000..55c0aab29b73 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Origin.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Origin.java new file mode 100644 index 000000000000..81f94e362d26 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ProvisioningState.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ProvisioningState.java new file mode 100644 index 000000000000..661f6af3216b --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the current operation. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource provisioning Successful. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource provisioning Failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource provisioning Canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Resource is being Provisioned. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Resource is being Updated. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Resource is being Deleted. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Resource is being Accepted. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsDetailsCommon.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsDetailsCommon.java new file mode 100644 index 000000000000..43211b3465f5 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsDetailsCommon.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; +import java.util.List; + +/** + * The savings details. + */ +@Immutable +public final class SavingsDetailsCommon implements JsonSerializable { + /* + * The savings options. + */ + private SavingsOptions savingOptions; + + /* + * The sku cost details per azure offer type. + */ + private List savingsDetail; + + /** + * Creates an instance of SavingsDetailsCommon class. + */ + private SavingsDetailsCommon() { + } + + /** + * Get the savingOptions property: The savings options. + * + * @return the savingOptions value. + */ + public SavingsOptions savingOptions() { + return this.savingOptions; + } + + /** + * Get the savingsDetail property: The sku cost details per azure offer type. + * + * @return the savingsDetail value. + */ + public List savingsDetail() { + return this.savingsDetail; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (savingsDetail() != null) { + savingsDetail().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SavingsDetailsCommon from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SavingsDetailsCommon 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 SavingsDetailsCommon. + */ + public static SavingsDetailsCommon fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SavingsDetailsCommon deserializedSavingsDetailsCommon = new SavingsDetailsCommon(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("savingOptions".equals(fieldName)) { + deserializedSavingsDetailsCommon.savingOptions = SavingsOptions.fromString(reader.getString()); + } else if ("savingsDetail".equals(fieldName)) { + List savingsDetail + = reader.readArray(reader1 -> NameValuePairSavingsType.fromJson(reader1)); + deserializedSavingsDetailsCommon.savingsDetail = savingsDetail; + } else { + reader.skipChildren(); + } + } + + return deserializedSavingsDetailsCommon; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsOptions.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsOptions.java new file mode 100644 index 000000000000..ada7eed70ebf --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsOptions.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The savings options. + */ +public final class SavingsOptions extends ExpandableStringEnum { + /** + * No savings options. + */ + public static final SavingsOptions NONE = fromString("None"); + + /** + * Reserved Instance for 1 year. + */ + public static final SavingsOptions RI1YEAR = fromString("RI1Year"); + + /** + * Reserved Instance for 3 years. + */ + public static final SavingsOptions RI3YEAR = fromString("RI3Year"); + + /** + * The savings plan for 1 year. + */ + public static final SavingsOptions SAVINGS_PLAN1YEAR = fromString("SavingsPlan1Year"); + + /** + * The savings plan for 3 years. + */ + public static final SavingsOptions SAVINGS_PLAN3YEAR = fromString("SavingsPlan3Year"); + + /** + * Custom azure offer code. + */ + public static final SavingsOptions CUSTOM_AZURE_OFFER_CODE = fromString("CustomAzureOfferCode"); + + /** + * Creates a new instance of SavingsOptions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SavingsOptions() { + } + + /** + * Creates or finds a SavingsOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding SavingsOptions. + */ + public static SavingsOptions fromString(String name) { + return fromString(name, SavingsOptions.class); + } + + /** + * Gets known SavingsOptions values. + * + * @return known SavingsOptions values. + */ + public static Collection values() { + return values(SavingsOptions.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsType.java new file mode 100644 index 000000000000..b973f9265774 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SavingsType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Savings type. + */ +public final class SavingsType extends ExpandableStringEnum { + /** + * MonthlyAzureHybridCostSavings - Savings type. + */ + public static final SavingsType MONTHLY_AZURE_HYBRID_COST_SAVINGS = fromString("MonthlyAzureHybridCostSavings"); + + /** + * MonthlyLinuxAzureHybridCostSavings - Savings type. + */ + public static final SavingsType MONTHLY_LINUX_AZURE_HYBRID_COST_SAVINGS + = fromString("MonthlyLinuxAzureHybridCostSavings"); + + /** + * MonthlyAhubSqlCostSavings - Savings type. + */ + public static final SavingsType MONTHLY_AHUB_SQL_COST_SAVINGS = fromString("MonthlyAhubSqlCostSavings"); + + /** + * MonthlyVcfByolCostDifference - Savings type. + */ + public static final SavingsType MONTHLY_VCF_BYOL_COST_DIFFERENCE = fromString("MonthlyVcfByolCostDifference"); + + /** + * Creates a new instance of SavingsType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SavingsType() { + } + + /** + * Creates or finds a SavingsType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SavingsType. + */ + public static SavingsType fromString(String name) { + return fromString(name, SavingsType.class); + } + + /** + * Gets known SavingsType values. + * + * @return known SavingsType values. + */ + public static Collection values() { + return values(SavingsType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SourceDetails.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SourceDetails.java new file mode 100644 index 000000000000..e47f60b477f0 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SourceDetails.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; + +/** + * Source details. + */ +@Immutable +public final class SourceDetails implements JsonSerializable { + /* + * The source name. + */ + private AssessmentSource sourceName; + + /* + * The source type. + */ + private MigrateWorkloadType sourceType; + + /* + * The migration platform. + */ + private MigrationPlatform platform; + + /* + * The count of a type of source. + */ + private Integer count; + + /** + * Creates an instance of SourceDetails class. + */ + private SourceDetails() { + } + + /** + * Get the sourceName property: The source name. + * + * @return the sourceName value. + */ + public AssessmentSource sourceName() { + return this.sourceName; + } + + /** + * Get the sourceType property: The source type. + * + * @return the sourceType value. + */ + public MigrateWorkloadType sourceType() { + return this.sourceType; + } + + /** + * Get the platform property: The migration platform. + * + * @return the platform value. + */ + public MigrationPlatform platform() { + return this.platform; + } + + /** + * Get the count property: The count of a type of source. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceDetails 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 SourceDetails. + */ + public static SourceDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceDetails deserializedSourceDetails = new SourceDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceName".equals(fieldName)) { + deserializedSourceDetails.sourceName = AssessmentSource.fromString(reader.getString()); + } else if ("sourceType".equals(fieldName)) { + deserializedSourceDetails.sourceType = MigrateWorkloadType.fromString(reader.getString()); + } else if ("platform".equals(fieldName)) { + deserializedSourceDetails.platform = MigrationPlatform.fromString(reader.getString()); + } else if ("count".equals(fieldName)) { + deserializedSourceDetails.count = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceDetails; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SummaryType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SummaryType.java new file mode 100644 index 000000000000..8c2a32450556 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/SummaryType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Summary Type. + */ +public final class SummaryType extends ExpandableStringEnum { + /** + * Unknown - Summary Type. + */ + public static final SummaryType UNKNOWN = fromString("Unknown"); + + /** + * Strategy - Summary Type. + */ + public static final SummaryType STRATEGY = fromString("Strategy"); + + /** + * Target - Summary Type. + */ + public static final SummaryType TARGET = fromString("Target"); + + /** + * Creates a new instance of SummaryType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SummaryType() { + } + + /** + * Creates or finds a SummaryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SummaryType. + */ + public static SummaryType fromString(String name) { + return fromString(name, SummaryType.class); + } + + /** + * Gets known SummaryType values. + * + * @return known SummaryType values. + */ + public static Collection values() { + return values(SummaryType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetAssessmentArmIds.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetAssessmentArmIds.java new file mode 100644 index 000000000000..af5924796006 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetAssessmentArmIds.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * ARM IDs of the target assessments. + */ +@Fluent +public final class TargetAssessmentArmIds implements JsonSerializable { + /* + * ARM ID for Azure Kubernetes Service assessment. + */ + private String aks; + + /* + * ARM ID for Azure App Service assessment. + */ + private String azureAppService; + + /* + * ARM ID for Azure App Service Container assessment. + */ + private String azureAppServiceContainer; + + /** + * Creates an instance of TargetAssessmentArmIds class. + */ + public TargetAssessmentArmIds() { + } + + /** + * Get the aks property: ARM ID for Azure Kubernetes Service assessment. + * + * @return the aks value. + */ + public String aks() { + return this.aks; + } + + /** + * Set the aks property: ARM ID for Azure Kubernetes Service assessment. + * + * @param aks the aks value to set. + * @return the TargetAssessmentArmIds object itself. + */ + public TargetAssessmentArmIds withAks(String aks) { + this.aks = aks; + return this; + } + + /** + * Get the azureAppService property: ARM ID for Azure App Service assessment. + * + * @return the azureAppService value. + */ + public String azureAppService() { + return this.azureAppService; + } + + /** + * Set the azureAppService property: ARM ID for Azure App Service assessment. + * + * @param azureAppService the azureAppService value to set. + * @return the TargetAssessmentArmIds object itself. + */ + public TargetAssessmentArmIds withAzureAppService(String azureAppService) { + this.azureAppService = azureAppService; + return this; + } + + /** + * Get the azureAppServiceContainer property: ARM ID for Azure App Service Container assessment. + * + * @return the azureAppServiceContainer value. + */ + public String azureAppServiceContainer() { + return this.azureAppServiceContainer; + } + + /** + * Set the azureAppServiceContainer property: ARM ID for Azure App Service Container assessment. + * + * @param azureAppServiceContainer the azureAppServiceContainer value to set. + * @return the TargetAssessmentArmIds object itself. + */ + public TargetAssessmentArmIds withAzureAppServiceContainer(String azureAppServiceContainer) { + this.azureAppServiceContainer = azureAppServiceContainer; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("aks", this.aks); + jsonWriter.writeStringField("azureAppService", this.azureAppService); + jsonWriter.writeStringField("azureAppServiceContainer", this.azureAppServiceContainer); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetAssessmentArmIds from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetAssessmentArmIds 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 TargetAssessmentArmIds. + */ + public static TargetAssessmentArmIds fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetAssessmentArmIds deserializedTargetAssessmentArmIds = new TargetAssessmentArmIds(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("aks".equals(fieldName)) { + deserializedTargetAssessmentArmIds.aks = reader.getString(); + } else if ("azureAppService".equals(fieldName)) { + deserializedTargetAssessmentArmIds.azureAppService = reader.getString(); + } else if ("azureAppServiceContainer".equals(fieldName)) { + deserializedTargetAssessmentArmIds.azureAppServiceContainer = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetAssessmentArmIds; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetDetails.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetDetails.java new file mode 100644 index 000000000000..7c6732598252 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetDetails.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; + +/** + * Target details. + */ +@Immutable +public final class TargetDetails implements JsonSerializable { + /* + * The target name. + */ + private AzureTarget targetName; + + /* + * The target type. + */ + private MigrateWorkloadType targetType; + + /* + * The migration platform. + */ + private MigrationPlatform platform; + + /* + * The count of a type of source. + */ + private Integer count; + + /** + * Creates an instance of TargetDetails class. + */ + private TargetDetails() { + } + + /** + * Get the targetName property: The target name. + * + * @return the targetName value. + */ + public AzureTarget targetName() { + return this.targetName; + } + + /** + * Get the targetType property: The target type. + * + * @return the targetType value. + */ + public MigrateWorkloadType targetType() { + return this.targetType; + } + + /** + * Get the platform property: The migration platform. + * + * @return the platform value. + */ + public MigrationPlatform platform() { + return this.platform; + } + + /** + * Get the count property: The count of a type of source. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetDetails 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 TargetDetails. + */ + public static TargetDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetDetails deserializedTargetDetails = new TargetDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetName".equals(fieldName)) { + deserializedTargetDetails.targetName = AzureTarget.fromString(reader.getString()); + } else if ("targetType".equals(fieldName)) { + deserializedTargetDetails.targetType = MigrateWorkloadType.fromString(reader.getString()); + } else if ("platform".equals(fieldName)) { + deserializedTargetDetails.platform = MigrationPlatform.fromString(reader.getString()); + } else if ("count".equals(fieldName)) { + deserializedTargetDetails.count = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetDetails; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetSourcePair.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetSourcePair.java new file mode 100644 index 000000000000..9caff40246a2 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/TargetSourcePair.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; +import java.util.List; + +/** + * Target source pair. + */ +@Immutable +public final class TargetSourcePair implements JsonSerializable { + /* + * The source name. + */ + private AssessmentSource sourceRef; + + /* + * The target name. + */ + private AzureTarget targetRef; + + /* + * The count of a type of source. + */ + private Integer sourceCount; + + /* + * The count of a type of target. + */ + private Integer targetCount; + + /* + * The migration details. + */ + private MigrationDetails migrationDetails; + + /* + * The management details. + */ + private List managementDetails; + + /* + * The cost details. + */ + private List costDetails; + + /* + * The savings details. + */ + private List savingsDetails; + + /* + * The confidence score. + */ + private Double confidenceScore; + + /** + * Creates an instance of TargetSourcePair class. + */ + private TargetSourcePair() { + } + + /** + * Get the sourceRef property: The source name. + * + * @return the sourceRef value. + */ + public AssessmentSource sourceRef() { + return this.sourceRef; + } + + /** + * Get the targetRef property: The target name. + * + * @return the targetRef value. + */ + public AzureTarget targetRef() { + return this.targetRef; + } + + /** + * Get the sourceCount property: The count of a type of source. + * + * @return the sourceCount value. + */ + public Integer sourceCount() { + return this.sourceCount; + } + + /** + * Get the targetCount property: The count of a type of target. + * + * @return the targetCount value. + */ + public Integer targetCount() { + return this.targetCount; + } + + /** + * Get the migrationDetails property: The migration details. + * + * @return the migrationDetails value. + */ + public MigrationDetails migrationDetails() { + return this.migrationDetails; + } + + /** + * Get the managementDetails property: The management details. + * + * @return the managementDetails value. + */ + public List managementDetails() { + return this.managementDetails; + } + + /** + * Get the costDetails property: The cost details. + * + * @return the costDetails value. + */ + public List costDetails() { + return this.costDetails; + } + + /** + * Get the savingsDetails property: The savings details. + * + * @return the savingsDetails value. + */ + public List savingsDetails() { + return this.savingsDetails; + } + + /** + * Get the confidenceScore property: The confidence score. + * + * @return the confidenceScore value. + */ + public Double confidenceScore() { + return this.confidenceScore; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (migrationDetails() != null) { + migrationDetails().validate(); + } + if (managementDetails() != null) { + managementDetails().forEach(e -> e.validate()); + } + if (costDetails() != null) { + costDetails().forEach(e -> e.validate()); + } + if (savingsDetails() != null) { + savingsDetails().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetSourcePair from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetSourcePair 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 TargetSourcePair. + */ + public static TargetSourcePair fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetSourcePair deserializedTargetSourcePair = new TargetSourcePair(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceRef".equals(fieldName)) { + deserializedTargetSourcePair.sourceRef = AssessmentSource.fromString(reader.getString()); + } else if ("targetRef".equals(fieldName)) { + deserializedTargetSourcePair.targetRef = AzureTarget.fromString(reader.getString()); + } else if ("sourceCount".equals(fieldName)) { + deserializedTargetSourcePair.sourceCount = reader.getNullable(JsonReader::getInt); + } else if ("targetCount".equals(fieldName)) { + deserializedTargetSourcePair.targetCount = reader.getNullable(JsonReader::getInt); + } else if ("migrationDetails".equals(fieldName)) { + deserializedTargetSourcePair.migrationDetails = MigrationDetails.fromJson(reader); + } else if ("managementDetails".equals(fieldName)) { + List managementDetails + = reader.readArray(reader1 -> ManagementDetails.fromJson(reader1)); + deserializedTargetSourcePair.managementDetails = managementDetails; + } else if ("costDetails".equals(fieldName)) { + List costDetails + = reader.readArray(reader1 -> CostDetailsCommon.fromJson(reader1)); + deserializedTargetSourcePair.costDetails = costDetails; + } else if ("savingsDetails".equals(fieldName)) { + List savingsDetails + = reader.readArray(reader1 -> SavingsDetailsCommon.fromJson(reader1)); + deserializedTargetSourcePair.savingsDetails = savingsDetails; + } else if ("confidenceScore".equals(fieldName)) { + deserializedTargetSourcePair.confidenceScore = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetSourcePair; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppCompoundAssessmentSummary.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppCompoundAssessmentSummary.java new file mode 100644 index 000000000000..a454f30f7d58 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppCompoundAssessmentSummary.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.migrate.fluent.models.WebAppCompoundAssessmentSummaryInner; + +/** + * An immutable client-side representation of WebAppCompoundAssessmentSummary. + */ +public interface WebAppCompoundAssessmentSummary { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + WebAppCompoundAssessmentSummaryProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.migrate.fluent.models.WebAppCompoundAssessmentSummaryInner object. + * + * @return the inner object. + */ + WebAppCompoundAssessmentSummaryInner innerModel(); +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppCompoundAssessmentSummaryProperties.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppCompoundAssessmentSummaryProperties.java new file mode 100644 index 000000000000..6218aacb4198 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppCompoundAssessmentSummaryProperties.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.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 java.io.IOException; +import java.util.List; + +/** + * WebApp compound assessment summary properties class. + */ +@Immutable +public final class WebAppCompoundAssessmentSummaryProperties + implements JsonSerializable { + /* + * The summary type + */ + private SummaryType summaryType; + + /* + * The summary name + */ + private String summaryName; + + /* + * The source details list. + */ + private List sources; + + /* + * The target details list. + */ + private List targets; + + /* + * The target source mapping. + */ + private List targetSourceMapping; + + /* + * The cost components. + */ + private List costComponents; + + /* + * The cost components. + */ + private List savingsComponents; + + /* + * Name of the assessment. + */ + private String assessmentName; + + /* + * Light summary of the compound assessment. + */ + private DiscoveredLightSummary discoveredLightSummary; + + /** + * Creates an instance of WebAppCompoundAssessmentSummaryProperties class. + */ + private WebAppCompoundAssessmentSummaryProperties() { + } + + /** + * Get the summaryType property: The summary type. + * + * @return the summaryType value. + */ + public SummaryType summaryType() { + return this.summaryType; + } + + /** + * Get the summaryName property: The summary name. + * + * @return the summaryName value. + */ + public String summaryName() { + return this.summaryName; + } + + /** + * Get the sources property: The source details list. + * + * @return the sources value. + */ + public List sources() { + return this.sources; + } + + /** + * Get the targets property: The target details list. + * + * @return the targets value. + */ + public List targets() { + return this.targets; + } + + /** + * Get the targetSourceMapping property: The target source mapping. + * + * @return the targetSourceMapping value. + */ + public List targetSourceMapping() { + return this.targetSourceMapping; + } + + /** + * Get the costComponents property: The cost components. + * + * @return the costComponents value. + */ + public List costComponents() { + return this.costComponents; + } + + /** + * Get the savingsComponents property: The cost components. + * + * @return the savingsComponents value. + */ + public List savingsComponents() { + return this.savingsComponents; + } + + /** + * Get the assessmentName property: Name of the assessment. + * + * @return the assessmentName value. + */ + public String assessmentName() { + return this.assessmentName; + } + + /** + * Get the discoveredLightSummary property: Light summary of the compound assessment. + * + * @return the discoveredLightSummary value. + */ + public DiscoveredLightSummary discoveredLightSummary() { + return this.discoveredLightSummary; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sources() != null) { + sources().forEach(e -> e.validate()); + } + if (targets() != null) { + targets().forEach(e -> e.validate()); + } + if (targetSourceMapping() != null) { + targetSourceMapping().forEach(e -> e.validate()); + } + if (costComponents() != null) { + costComponents().forEach(e -> e.validate()); + } + if (savingsComponents() != null) { + savingsComponents().forEach(e -> e.validate()); + } + if (discoveredLightSummary() != null) { + discoveredLightSummary().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("assessmentName", this.assessmentName); + jsonWriter.writeJsonField("discoveredLightSummary", this.discoveredLightSummary); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebAppCompoundAssessmentSummaryProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebAppCompoundAssessmentSummaryProperties 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 WebAppCompoundAssessmentSummaryProperties. + */ + public static WebAppCompoundAssessmentSummaryProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebAppCompoundAssessmentSummaryProperties deserializedWebAppCompoundAssessmentSummaryProperties + = new WebAppCompoundAssessmentSummaryProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("summaryType".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryProperties.summaryType + = SummaryType.fromString(reader.getString()); + } else if ("summaryName".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryProperties.summaryName = reader.getString(); + } else if ("sources".equals(fieldName)) { + List sources = reader.readArray(reader1 -> SourceDetails.fromJson(reader1)); + deserializedWebAppCompoundAssessmentSummaryProperties.sources = sources; + } else if ("targets".equals(fieldName)) { + List targets = reader.readArray(reader1 -> TargetDetails.fromJson(reader1)); + deserializedWebAppCompoundAssessmentSummaryProperties.targets = targets; + } else if ("targetSourceMapping".equals(fieldName)) { + List targetSourceMapping + = reader.readArray(reader1 -> TargetSourcePair.fromJson(reader1)); + deserializedWebAppCompoundAssessmentSummaryProperties.targetSourceMapping = targetSourceMapping; + } else if ("costComponents".equals(fieldName)) { + List costComponents + = reader.readArray(reader1 -> CostDetailsCommon.fromJson(reader1)); + deserializedWebAppCompoundAssessmentSummaryProperties.costComponents = costComponents; + } else if ("savingsComponents".equals(fieldName)) { + List savingsComponents + = reader.readArray(reader1 -> SavingsDetailsCommon.fromJson(reader1)); + deserializedWebAppCompoundAssessmentSummaryProperties.savingsComponents = savingsComponents; + } else if ("assessmentName".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryProperties.assessmentName = reader.getString(); + } else if ("discoveredLightSummary".equals(fieldName)) { + deserializedWebAppCompoundAssessmentSummaryProperties.discoveredLightSummary + = DiscoveredLightSummary.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWebAppCompoundAssessmentSummaryProperties; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppType.java new file mode 100644 index 000000000000..e84abb80b214 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Web App Type. + */ +public final class WebAppType extends ExpandableStringEnum { + /** + * Unknown. Indicates Missing Data. + */ + public static final WebAppType UNKNOWN = fromString("Unknown"); + + /** + * ASP.NET Web App. + */ + public static final WebAppType ASPNET = fromString("ASP.Net"); + + /** + * Java Web App. + */ + public static final WebAppType JAVA = fromString("Java"); + + /** + * Creates a new instance of WebAppType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public WebAppType() { + } + + /** + * Creates or finds a WebAppType from its string representation. + * + * @param name a name to look for. + * @return the corresponding WebAppType. + */ + public static WebAppType fromString(String name) { + return fromString(name, WebAppType.class); + } + + /** + * Gets known WebAppType values. + * + * @return known WebAppType values. + */ + public static Collection values() { + return values(WebAppType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppsPerType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppsPerType.java new file mode 100644 index 000000000000..8828db1b9ea9 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebAppsPerType.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Number of web apps per type. + */ +@Immutable +public final class WebAppsPerType implements JsonSerializable { + /* + * Name of the web app type. + */ + private WebAppType webAppType; + + /* + * Count of the web app type. + */ + private int count; + + /** + * Creates an instance of WebAppsPerType class. + */ + private WebAppsPerType() { + } + + /** + * Get the webAppType property: Name of the web app type. + * + * @return the webAppType value. + */ + public WebAppType webAppType() { + return this.webAppType; + } + + /** + * Get the count property: Count of the web app type. + * + * @return the count value. + */ + public int count() { + return this.count; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (webAppType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property webAppType in model WebAppsPerType")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WebAppsPerType.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("webAppType", this.webAppType == null ? null : this.webAppType.toString()); + jsonWriter.writeIntField("count", this.count); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebAppsPerType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebAppsPerType 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 WebAppsPerType. + */ + public static WebAppsPerType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebAppsPerType deserializedWebAppsPerType = new WebAppsPerType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("webAppType".equals(fieldName)) { + deserializedWebAppsPerType.webAppType = WebAppType.fromString(reader.getString()); + } else if ("count".equals(fieldName)) { + deserializedWebAppsPerType.count = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedWebAppsPerType; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebServerType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebServerType.java new file mode 100644 index 000000000000..5785c74f3715 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebServerType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Web Server Type. + */ +public final class WebServerType extends ExpandableStringEnum { + /** + * Unknown. Indicates Missing Data. + */ + public static final WebServerType UNKNOWN = fromString("Unknown"); + + /** + * ASP.NET Web App. + */ + public static final WebServerType IIS = fromString("IIS"); + + /** + * Java Web App. + */ + public static final WebServerType TOMCAT = fromString("Tomcat"); + + /** + * Creates a new instance of WebServerType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public WebServerType() { + } + + /** + * Creates or finds a WebServerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding WebServerType. + */ + public static WebServerType fromString(String name) { + return fromString(name, WebServerType.class); + } + + /** + * Gets known WebServerType values. + * + * @return known WebServerType values. + */ + public static Collection values() { + return values(WebServerType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebServersPerType.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebServersPerType.java new file mode 100644 index 000000000000..969b31c94fa3 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/WebServersPerType.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Number of web servers per type. + */ +@Immutable +public final class WebServersPerType implements JsonSerializable { + /* + * Name of the web app type. + */ + private WebServerType webServerType; + + /* + * Count of the web app type. + */ + private int count; + + /** + * Creates an instance of WebServersPerType class. + */ + private WebServersPerType() { + } + + /** + * Get the webServerType property: Name of the web app type. + * + * @return the webServerType value. + */ + public WebServerType webServerType() { + return this.webServerType; + } + + /** + * Get the count property: Count of the web app type. + * + * @return the count value. + */ + public int count() { + return this.count; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (webServerType() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property webServerType in model WebServersPerType")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WebServersPerType.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("webServerType", this.webServerType == null ? null : this.webServerType.toString()); + jsonWriter.writeIntField("count", this.count); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WebServersPerType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WebServersPerType 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 WebServersPerType. + */ + public static WebServersPerType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WebServersPerType deserializedWebServersPerType = new WebServersPerType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("webServerType".equals(fieldName)) { + deserializedWebServersPerType.webServerType = WebServerType.fromString(reader.getString()); + } else if ("count".equals(fieldName)) { + deserializedWebServersPerType.count = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedWebServersPerType; + }); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/package-info.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/package-info.java new file mode 100644 index 000000000000..a4bdc739698a --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Migrate. + * Azure Migrate Resource Provider management API. + */ +package com.azure.resourcemanager.migrate.models; diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/package-info.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/package-info.java new file mode 100644 index 000000000000..2bf956d7b26c --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/com/azure/resourcemanager/migrate/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for Migrate. + * Azure Migrate Resource Provider management API. + */ +package com.azure.resourcemanager.migrate; diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/java/module-info.java b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/module-info.java new file mode 100644 index 000000000000..c9cf891f2a5d --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.migrate { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.migrate; + exports com.azure.resourcemanager.migrate.fluent; + exports com.azure.resourcemanager.migrate.fluent.models; + exports com.azure.resourcemanager.migrate.models; + + opens com.azure.resourcemanager.migrate.fluent.models to com.azure.core; + opens com.azure.resourcemanager.migrate.models to com.azure.core; + opens com.azure.resourcemanager.migrate.implementation.models to com.azure.core; +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-migrate/proxy-config.json b/sdk/migrate/azure-resourcemanager-migrate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-migrate/proxy-config.json new file mode 100644 index 000000000000..7ecb80fb192f --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-migrate/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.migrate.implementation.CompoundAssessmentOperationsClientImpl$CompoundAssessmentOperationsService"],["com.azure.resourcemanager.migrate.implementation.CompoundAssessmentSummaryOperationsClientImpl$CompoundAssessmentSummaryOperationsService"],["com.azure.resourcemanager.migrate.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-migrate/reflect-config.json b/sdk/migrate/azure-resourcemanager-migrate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-migrate/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-migrate/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/main/resources/azure-resourcemanager-migrate.properties b/sdk/migrate/azure-resourcemanager-migrate/src/main/resources/azure-resourcemanager-migrate.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/main/resources/azure-resourcemanager-migrate.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsCreateSamples.java b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsCreateSamples.java new file mode 100644 index 000000000000..65d298d90299 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsCreateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.resourcemanager.migrate.models.CompoundAssessmentProperties; +import com.azure.resourcemanager.migrate.models.TargetAssessmentArmIds; + +/** + * Samples for CompoundAssessmentOperations Create. + */ +public final class CompoundAssessmentOperationsCreateSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_Create_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_Create. + * + * @param manager Entry point to MigrateManager. + */ + public static void compoundAssessmentOperationsCreate(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .define("assessmentName") + .withExistingAssessmentProject("rgwebAppCompoundAssessments", "contosoProject") + .withProperties(new CompoundAssessmentProperties().withTargetAssessmentArmIds(new TargetAssessmentArmIds() + .withAks( + "/subscriptions/6898488D-BBF0-40FC-A5E3-3DF2C00C5F21/resourceGroups/rgwebAppCompoundAssessments/providers/Microsoft.Migrate/assessmentprojects/contosoProject/aksAssessments/nameOfAssessment") + .withAzureAppService( + "/subscriptions/6898488D-BBF0-40FC-A5E3-3DF2C00C5F21/resourceGroups/rgwebAppCompoundAssessments/providers/Microsoft.Migrate/assessmentprojects/contosoProject/webAppAssessments/nameOfAssessment") + .withAzureAppServiceContainer( + "/subscriptions/6898488D-BBF0-40FC-A5E3-3DF2C00C5F21/resourceGroups/rgwebAppCompoundAssessments/providers/Microsoft.Migrate/assessmentprojects/contosoProject/webAppAssessments/nameOfAssessment")) + .withFallbackMachineAssessmentArmId( + "/subscriptions/6898488D-BBF0-40FC-A5E3-3DF2C00C5F21/resourceGroups/rgwebAppCompoundAssessments/providers/Microsoft.Migrate/assessmentprojects/contosoProject/assessments/nameOfAssessment")) + .create(); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDeleteSamples.java b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDeleteSamples.java new file mode 100644 index 000000000000..88618d70aa94 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +/** + * Samples for CompoundAssessmentOperations Delete. + */ +public final class CompoundAssessmentOperationsDeleteSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_Delete. + * + * @param manager Entry point to MigrateManager. + */ + public static void compoundAssessmentOperationsDelete(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .deleteWithResponse("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDownloadUrlSamples.java b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDownloadUrlSamples.java new file mode 100644 index 000000000000..e285e2e6de92 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDownloadUrlSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.resourcemanager.migrate.models.DownloadUrlRequest; + +/** + * Samples for CompoundAssessmentOperations DownloadUrl. + */ +public final class CompoundAssessmentOperationsDownloadUrlSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_DownloadUrl_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_DownloadUrl. + * + * @param manager Entry point to MigrateManager. + */ + public static void + compoundAssessmentOperationsDownloadUrl(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .downloadUrl("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", new DownloadUrlRequest(), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsGetSamples.java b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsGetSamples.java new file mode 100644 index 000000000000..67fd9c68b89a --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +/** + * Samples for CompoundAssessmentOperations Get. + */ +public final class CompoundAssessmentOperationsGetSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_Get_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_Get. + * + * @param manager Entry point to MigrateManager. + */ + public static void compoundAssessmentOperationsGet(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .getWithResponse("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsListByParentSamples.java b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsListByParentSamples.java new file mode 100644 index 000000000000..79d2731f08e5 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsListByParentSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +/** + * Samples for CompoundAssessmentOperations ListByParent. + */ +public final class CompoundAssessmentOperationsListByParentSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentOperations_ListByParent_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentOperations_ListByParent. + * + * @param manager Entry point to MigrateManager. + */ + public static void + compoundAssessmentOperationsListByParent(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentOperations() + .listByParent("rgwebAppCompoundAssessments", "contosoProject", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsGetSamples.java b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsGetSamples.java new file mode 100644 index 000000000000..221bfbc3184b --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +/** + * Samples for CompoundAssessmentSummaryOperations Get. + */ +public final class CompoundAssessmentSummaryOperationsGetSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentSummaryOperations_Get_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentSummaryOperations_Get. + * + * @param manager Entry point to MigrateManager. + */ + public static void + compoundAssessmentSummaryOperationsGet(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentSummaryOperations() + .getWithResponse("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", "Modernize", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsListByParentSamples.java b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsListByParentSamples.java new file mode 100644 index 000000000000..c4438d38e925 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsListByParentSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +/** + * Samples for CompoundAssessmentSummaryOperations ListByParent. + */ +public final class CompoundAssessmentSummaryOperationsListByParentSamples { + /* + * x-ms-original-file: 2024-03-03-preview/CompoundAssessmentSummaryOperations_ListByParent_MaximumSet_Gen.json + */ + /** + * Sample code: CompoundAssessmentSummaryOperations_ListByParent. + * + * @param manager Entry point to MigrateManager. + */ + public static void + compoundAssessmentSummaryOperationsListByParent(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.compoundAssessmentSummaryOperations() + .listByParent("rgwebAppCompoundAssessments", "contosoProject", "assessmentName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/OperationsListSamples.java b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/OperationsListSamples.java new file mode 100644 index 000000000000..b2cb07af1252 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/samples/java/com/azure/resourcemanager/migrate/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2024-03-03-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MigrateManager. + */ + public static void operationsList(com.azure.resourcemanager.migrate.MigrateManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentDetailsTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentDetailsTests.java new file mode 100644 index 000000000000..f409baf9cfa6 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentDetailsTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.AssessmentStatus; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentDetails; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class CompoundAssessmentDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CompoundAssessmentDetails model = BinaryData.fromString( + "{\"createdTimestamp\":\"2021-10-17T17:25:15Z\",\"updatedTimestamp\":\"2021-01-09T01:59:33Z\",\"status\":\"Updated\"}") + .toObject(CompoundAssessmentDetails.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T17:25:15Z"), model.createdTimestamp()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-09T01:59:33Z"), model.updatedTimestamp()); + Assertions.assertEquals(AssessmentStatus.UPDATED, model.status()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentInnerTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentInnerTests.java new file mode 100644 index 000000000000..ba3352e83369 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentInnerTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.fluent.models.CompoundAssessmentInner; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentProperties; +import com.azure.resourcemanager.migrate.models.TargetAssessmentArmIds; +import org.junit.jupiter.api.Assertions; + +public final class CompoundAssessmentInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CompoundAssessmentInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"targetAssessmentArmIds\":{\"aks\":\"pzvgnwzsymglzufc\",\"azureAppService\":\"kohdbiha\",\"azureAppServiceContainer\":\"fhfcb\"},\"fallbackMachineAssessmentArmId\":\"s\",\"details\":{\"createdTimestamp\":\"2021-01-26T06:35:32Z\",\"updatedTimestamp\":\"2021-05-03T19:17:55Z\",\"status\":\"Failed\"}},\"id\":\"abifpikxwczbys\",\"name\":\"npqxuh\",\"type\":\"vyq\"}") + .toObject(CompoundAssessmentInner.class); + Assertions.assertEquals("pzvgnwzsymglzufc", model.properties().targetAssessmentArmIds().aks()); + Assertions.assertEquals("kohdbiha", model.properties().targetAssessmentArmIds().azureAppService()); + Assertions.assertEquals("fhfcb", model.properties().targetAssessmentArmIds().azureAppServiceContainer()); + Assertions.assertEquals("s", model.properties().fallbackMachineAssessmentArmId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CompoundAssessmentInner model + = new CompoundAssessmentInner().withProperties(new CompoundAssessmentProperties() + .withTargetAssessmentArmIds(new TargetAssessmentArmIds().withAks("pzvgnwzsymglzufc") + .withAzureAppService("kohdbiha") + .withAzureAppServiceContainer("fhfcb")) + .withFallbackMachineAssessmentArmId("s")); + model = BinaryData.fromObject(model).toObject(CompoundAssessmentInner.class); + Assertions.assertEquals("pzvgnwzsymglzufc", model.properties().targetAssessmentArmIds().aks()); + Assertions.assertEquals("kohdbiha", model.properties().targetAssessmentArmIds().azureAppService()); + Assertions.assertEquals("fhfcb", model.properties().targetAssessmentArmIds().azureAppServiceContainer()); + Assertions.assertEquals("s", model.properties().fallbackMachineAssessmentArmId()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentListResultTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentListResultTests.java new file mode 100644 index 000000000000..6c5fe02ae3e8 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentListResultTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.implementation.models.CompoundAssessmentListResult; +import org.junit.jupiter.api.Assertions; + +public final class CompoundAssessmentListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CompoundAssessmentListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"targetAssessmentArmIds\":{\"aks\":\"npmqnjaqwixjspro\",\"azureAppService\":\"cputegjvwmfdats\",\"azureAppServiceContainer\":\"dvpjhulsuuvmk\"},\"fallbackMachineAssessmentArmId\":\"zkrwfn\",\"details\":{\"createdTimestamp\":\"2021-06-07T05:45:20Z\",\"updatedTimestamp\":\"2021-09-01T06:44:17Z\",\"status\":\"OutOfSync\"}},\"id\":\"w\",\"name\":\"jdpvwryo\",\"type\":\"psoacctazakljl\"},{\"properties\":{\"provisioningState\":\"Failed\",\"targetAssessmentArmIds\":{\"aks\":\"yffdfdos\",\"azureAppService\":\"expa\",\"azureAppServiceContainer\":\"akhmsbzjhcrz\"},\"fallbackMachineAssessmentArmId\":\"dphlxaolt\",\"details\":{\"createdTimestamp\":\"2021-03-26T21:15:35Z\",\"updatedTimestamp\":\"2021-11-21T18:08:48Z\",\"status\":\"Created\"}},\"id\":\"pfzfsinzgvfc\",\"name\":\"rwzoxxjtfelluwf\",\"type\":\"it\"}],\"nextLink\":\"peqfpjkjl\"}") + .toObject(CompoundAssessmentListResult.class); + Assertions.assertEquals("npmqnjaqwixjspro", model.value().get(0).properties().targetAssessmentArmIds().aks()); + Assertions.assertEquals("cputegjvwmfdats", + model.value().get(0).properties().targetAssessmentArmIds().azureAppService()); + Assertions.assertEquals("dvpjhulsuuvmk", + model.value().get(0).properties().targetAssessmentArmIds().azureAppServiceContainer()); + Assertions.assertEquals("zkrwfn", model.value().get(0).properties().fallbackMachineAssessmentArmId()); + Assertions.assertEquals("peqfpjkjl", model.nextLink()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsCreateMockTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsCreateMockTests.java new file mode 100644 index 000000000000..87dec4f3beef --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsCreateMockTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.migrate.MigrateManager; +import com.azure.resourcemanager.migrate.models.CompoundAssessment; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentProperties; +import com.azure.resourcemanager.migrate.models.TargetAssessmentArmIds; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CompoundAssessmentOperationsCreateMockTests { + @Test + public void testCreate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"targetAssessmentArmIds\":{\"aks\":\"ugw\",\"azureAppService\":\"cglhslazjdyggdt\",\"azureAppServiceContainer\":\"xhbkuofq\"},\"fallbackMachineAssessmentArmId\":\"yk\",\"details\":{\"createdTimestamp\":\"2021-06-19T17:30:56Z\",\"updatedTimestamp\":\"2021-06-22T03:52:42Z\",\"status\":\"Running\"}},\"id\":\"exfwhy\",\"name\":\"cibvyvdcsitynn\",\"type\":\"amdecte\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MigrateManager manager = MigrateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CompoundAssessment response = manager.compoundAssessmentOperations() + .define("v") + .withExistingAssessmentProject("alhbx", "hejjz") + .withProperties(new CompoundAssessmentProperties() + .withTargetAssessmentArmIds(new TargetAssessmentArmIds().withAks("dslfhotwmcy") + .withAzureAppService("wlbjnpgacftade") + .withAzureAppServiceContainer("nltyfsoppusuesnz")) + .withFallbackMachineAssessmentArmId("ej")) + .create(); + + Assertions.assertEquals("ugw", response.properties().targetAssessmentArmIds().aks()); + Assertions.assertEquals("cglhslazjdyggdt", response.properties().targetAssessmentArmIds().azureAppService()); + Assertions.assertEquals("xhbkuofq", response.properties().targetAssessmentArmIds().azureAppServiceContainer()); + Assertions.assertEquals("yk", response.properties().fallbackMachineAssessmentArmId()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDeleteWithResponseMockTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..ce4d00543091 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDeleteWithResponseMockTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.migrate.MigrateManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CompoundAssessmentOperationsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MigrateManager manager = MigrateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.compoundAssessmentOperations() + .deleteWithResponse("chcbonqvpkvlrxnj", "ase", "pheoflokeyy", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDownloadUrlMockTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDownloadUrlMockTests.java new file mode 100644 index 000000000000..27e430a55078 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsDownloadUrlMockTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.migrate.MigrateManager; +import com.azure.resourcemanager.migrate.models.DownloadUrl; +import com.azure.resourcemanager.migrate.models.DownloadUrlRequest; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CompoundAssessmentOperationsDownloadUrlMockTests { + @Test + public void testDownloadUrl() throws Exception { + String responseStr = "{\"assessmentReportUrl\":\"e\",\"expirationTime\":\"2021-10-21T12:52:50Z\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MigrateManager manager = MigrateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + DownloadUrl response = manager.compoundAssessmentOperations() + .downloadUrl("enjbdlwtgrhp", "jp", "umasxazjpq", new DownloadUrlRequest(), + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsGetWithResponseMockTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsGetWithResponseMockTests.java new file mode 100644 index 000000000000..c6503c8aa490 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsGetWithResponseMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.migrate.MigrateManager; +import com.azure.resourcemanager.migrate.models.CompoundAssessment; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CompoundAssessmentOperationsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Accepted\",\"targetAssessmentArmIds\":{\"aks\":\"giotkftutqxlngx\",\"azureAppService\":\"fgugnxkrxdqmid\",\"azureAppServiceContainer\":\"hzrvqd\"},\"fallbackMachineAssessmentArmId\":\"bhj\",\"details\":{\"createdTimestamp\":\"2021-02-21T23:50:40Z\",\"updatedTimestamp\":\"2021-05-29T13:44:30Z\",\"status\":\"Updated\"}},\"id\":\"fbowskanyk\",\"name\":\"zlcuiywgqywgndrv\",\"type\":\"nhzgpphrcgyn\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MigrateManager manager = MigrateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CompoundAssessment response = manager.compoundAssessmentOperations() + .getWithResponse("xuigdtopbobj", "ghmewuam", "uhrzayvvt", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("giotkftutqxlngx", response.properties().targetAssessmentArmIds().aks()); + Assertions.assertEquals("fgugnxkrxdqmid", response.properties().targetAssessmentArmIds().azureAppService()); + Assertions.assertEquals("hzrvqd", response.properties().targetAssessmentArmIds().azureAppServiceContainer()); + Assertions.assertEquals("bhj", response.properties().fallbackMachineAssessmentArmId()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsListByParentMockTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsListByParentMockTests.java new file mode 100644 index 000000000000..3c6d3606edda --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentOperationsListByParentMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.migrate.MigrateManager; +import com.azure.resourcemanager.migrate.models.CompoundAssessment; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CompoundAssessmentOperationsListByParentMockTests { + @Test + public void testListByParent() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"targetAssessmentArmIds\":{\"aks\":\"ivkwlzuvccfwnfnb\",\"azureAppService\":\"fionl\",\"azureAppServiceContainer\":\"x\"},\"fallbackMachineAssessmentArmId\":\"qgtz\",\"details\":{\"createdTimestamp\":\"2021-11-11T19:24:47Z\",\"updatedTimestamp\":\"2021-04-08T18:16:48Z\",\"status\":\"Created\"}},\"id\":\"wxrjfeallnwsub\",\"name\":\"snjampmng\",\"type\":\"zscxaqwo\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MigrateManager manager = MigrateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.compoundAssessmentOperations() + .listByParent("ocpecfvmmco", "fsxlzevgbmqjqa", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ivkwlzuvccfwnfnb", + response.iterator().next().properties().targetAssessmentArmIds().aks()); + Assertions.assertEquals("fionl", + response.iterator().next().properties().targetAssessmentArmIds().azureAppService()); + Assertions.assertEquals("x", + response.iterator().next().properties().targetAssessmentArmIds().azureAppServiceContainer()); + Assertions.assertEquals("qgtz", response.iterator().next().properties().fallbackMachineAssessmentArmId()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentPropertiesTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentPropertiesTests.java new file mode 100644 index 000000000000..fffc31d1fef5 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentPropertiesTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.CompoundAssessmentProperties; +import com.azure.resourcemanager.migrate.models.TargetAssessmentArmIds; +import org.junit.jupiter.api.Assertions; + +public final class CompoundAssessmentPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CompoundAssessmentProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Deleting\",\"targetAssessmentArmIds\":{\"aks\":\"ybrk\",\"azureAppService\":\"dumjgrtfwvuk\",\"azureAppServiceContainer\":\"audccsnhs\"},\"fallbackMachineAssessmentArmId\":\"nyejhkryhtnap\",\"details\":{\"createdTimestamp\":\"2021-08-26T01:22Z\",\"updatedTimestamp\":\"2021-04-01T20:27:42Z\",\"status\":\"Created\"}}") + .toObject(CompoundAssessmentProperties.class); + Assertions.assertEquals("ybrk", model.targetAssessmentArmIds().aks()); + Assertions.assertEquals("dumjgrtfwvuk", model.targetAssessmentArmIds().azureAppService()); + Assertions.assertEquals("audccsnhs", model.targetAssessmentArmIds().azureAppServiceContainer()); + Assertions.assertEquals("nyejhkryhtnap", model.fallbackMachineAssessmentArmId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CompoundAssessmentProperties model + = new CompoundAssessmentProperties().withTargetAssessmentArmIds(new TargetAssessmentArmIds().withAks("ybrk") + .withAzureAppService("dumjgrtfwvuk") + .withAzureAppServiceContainer("audccsnhs")).withFallbackMachineAssessmentArmId("nyejhkryhtnap"); + model = BinaryData.fromObject(model).toObject(CompoundAssessmentProperties.class); + Assertions.assertEquals("ybrk", model.targetAssessmentArmIds().aks()); + Assertions.assertEquals("dumjgrtfwvuk", model.targetAssessmentArmIds().azureAppService()); + Assertions.assertEquals("audccsnhs", model.targetAssessmentArmIds().azureAppServiceContainer()); + Assertions.assertEquals("nyejhkryhtnap", model.fallbackMachineAssessmentArmId()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsGetWithResponseMockTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsGetWithResponseMockTests.java new file mode 100644 index 000000000000..d6c376a821a0 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsGetWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.migrate.MigrateManager; +import com.azure.resourcemanager.migrate.models.WebAppCompoundAssessmentSummary; +import com.azure.resourcemanager.migrate.models.WebAppType; +import com.azure.resourcemanager.migrate.models.WebServerType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CompoundAssessmentSummaryOperationsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"summaryType\":\"Unknown\",\"summaryName\":\"yvxyqjp\",\"sources\":[{\"sourceName\":\"SpringbootApplication\",\"sourceType\":\"Database\",\"platform\":\"SaaS\",\"count\":1035421848},{\"sourceName\":\"OracleServer\",\"sourceType\":\"WebApplication\",\"platform\":\"IaaS\",\"count\":1452431495},{\"sourceName\":\"Machine\",\"sourceType\":\"WebServer\",\"platform\":\"Unknown\",\"count\":1022740915},{\"sourceName\":\"OracleServer\",\"sourceType\":\"Host\",\"platform\":\"Unknown\",\"count\":97546857}],\"targets\":[{\"targetName\":\"MySQLAzureFlexServer\",\"targetType\":\"WebApplication\",\"platform\":\"Unknown\",\"count\":2029190304},{\"targetName\":\"Avs\",\"targetType\":\"WebApplication\",\"platform\":\"SaaS\",\"count\":1243645059},{\"targetName\":\"OracleIaasVM\",\"targetType\":\"WebServer\",\"platform\":\"Unknown\",\"count\":1605990961},{\"targetName\":\"FlexServerPG\",\"targetType\":\"Server\",\"platform\":\"IaaS\",\"count\":1958511129}],\"targetSourceMapping\":[{\"sourceRef\":\"OracleDatabase\",\"targetRef\":\"AzureSpringApps\",\"sourceCount\":1920880851,\"targetCount\":2084111616,\"migrationDetails\":{\"readinessSummary\":[{},{},{}],\"migrationType\":\"Retain\"},\"managementDetails\":[{},{},{},{}],\"costDetails\":[{},{},{},{}],\"savingsDetails\":[{}],\"confidenceScore\":75.4187100051518},{\"sourceRef\":\"Machine\",\"targetRef\":\"SqlMI\",\"sourceCount\":427242708,\"targetCount\":269303909,\"migrationDetails\":{\"readinessSummary\":[{},{},{},{}],\"migrationType\":\"Unknown\"},\"managementDetails\":[{},{},{},{}],\"costDetails\":[{}],\"savingsDetails\":[{},{},{},{}],\"confidenceScore\":4.201866864175463},{\"sourceRef\":\"IIS\",\"targetRef\":\"OracleIaasVM\",\"sourceCount\":854764023,\"targetCount\":1524544291,\"migrationDetails\":{\"readinessSummary\":[{},{},{},{}],\"migrationType\":\"Unknown\"},\"managementDetails\":[{},{},{}],\"costDetails\":[{},{},{}],\"savingsDetails\":[{}],\"confidenceScore\":64.2031591626506},{\"sourceRef\":\"OracleDatabase\",\"targetRef\":\"SAPAzureInstance\",\"sourceCount\":30564685,\"targetCount\":741108852,\"migrationDetails\":{\"readinessSummary\":[{}],\"migrationType\":\"Rehost\"},\"managementDetails\":[{},{}],\"costDetails\":[{},{},{},{}],\"savingsDetails\":[{}],\"confidenceScore\":0.24287252246378843}],\"costComponents\":[{\"savingOptions\":\"SavingsPlan1Year\",\"costDetail\":[{}]},{\"savingOptions\":\"SavingsPlan1Year\",\"costDetail\":[{}]}],\"savingsComponents\":[{\"savingOptions\":\"SavingsPlan1Year\",\"savingsDetail\":[{}]},{\"savingOptions\":\"SavingsPlan1Year\",\"savingsDetail\":[{},{},{},{}]},{\"savingOptions\":\"CustomAzureOfferCode\",\"savingsDetail\":[{},{},{},{}]}],\"assessmentName\":\"t\",\"discoveredLightSummary\":{\"numberOfWebApps\":207833423,\"numberOfWebAppsPerType\":[{\"webAppType\":\"Unknown\",\"count\":63177450},{\"webAppType\":\"Java\",\"count\":891101767},{\"webAppType\":\"ASP.Net\",\"count\":1493558591}],\"numberOfWebServersPerType\":[{\"webServerType\":\"IIS\",\"count\":1309614398},{\"webServerType\":\"Unknown\",\"count\":1520989721},{\"webServerType\":\"Unknown\",\"count\":223654021},{\"webServerType\":\"Unknown\",\"count\":306734530}],\"numberOfWebServers\":1177469779,\"numberOfServers\":124611793}},\"id\":\"sovmyokacspkwl\",\"name\":\"zdobpxjmflbvvnch\",\"type\":\"kcciwwzjuqkhr\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MigrateManager manager = MigrateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + WebAppCompoundAssessmentSummary response = manager.compoundAssessmentSummaryOperations() + .getWithResponse("f", "qsc", "eypvhezrkg", "hcjrefovgmk", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("t", response.properties().assessmentName()); + Assertions.assertEquals(207833423, response.properties().discoveredLightSummary().numberOfWebApps()); + Assertions.assertEquals(WebAppType.UNKNOWN, + response.properties().discoveredLightSummary().numberOfWebAppsPerType().get(0).webAppType()); + Assertions.assertEquals(63177450, + response.properties().discoveredLightSummary().numberOfWebAppsPerType().get(0).count()); + Assertions.assertEquals(WebServerType.IIS, + response.properties().discoveredLightSummary().numberOfWebServersPerType().get(0).webServerType()); + Assertions.assertEquals(1309614398, + response.properties().discoveredLightSummary().numberOfWebServersPerType().get(0).count()); + Assertions.assertEquals(1177469779, response.properties().discoveredLightSummary().numberOfWebServers()); + Assertions.assertEquals(124611793, response.properties().discoveredLightSummary().numberOfServers()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsListByParentMockTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsListByParentMockTests.java new file mode 100644 index 000000000000..367c7fba99b4 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CompoundAssessmentSummaryOperationsListByParentMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.migrate.MigrateManager; +import com.azure.resourcemanager.migrate.models.WebAppCompoundAssessmentSummary; +import com.azure.resourcemanager.migrate.models.WebAppType; +import com.azure.resourcemanager.migrate.models.WebServerType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CompoundAssessmentSummaryOperationsListByParentMockTests { + @Test + public void testListByParent() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"summaryType\":\"Target\",\"summaryName\":\"duugidyjr\",\"sources\":[{\"sourceName\":\"IIS\",\"sourceType\":\"Host\",\"platform\":\"Unknown\",\"count\":766224962}],\"targets\":[{\"targetName\":\"SqlDatabase\",\"targetType\":\"Instance\",\"platform\":\"IaaS\",\"count\":675704984}],\"targetSourceMapping\":[{\"sourceRef\":\"TomCat\",\"targetRef\":\"AzureAppServiceContainer\",\"sourceCount\":1486272447,\"targetCount\":529592400,\"migrationDetails\":{\"readinessSummary\":[{},{},{},{}],\"migrationType\":\"Unknown\"},\"managementDetails\":[{},{},{},{}],\"costDetails\":[{},{},{}],\"savingsDetails\":[{}],\"confidenceScore\":28.76282136834404},{\"sourceRef\":\"SAPInstance\",\"targetRef\":\"MySQLAzureFlexServer\",\"sourceCount\":1914432251,\"targetCount\":63986979,\"migrationDetails\":{\"readinessSummary\":[{},{}],\"migrationType\":\"Rearchitect\"},\"managementDetails\":[{},{},{}],\"costDetails\":[{},{},{},{}],\"savingsDetails\":[{},{}],\"confidenceScore\":97.56653262814537}],\"costComponents\":[{\"savingOptions\":\"RI3Year\",\"costDetail\":[{},{},{}]}],\"savingsComponents\":[{\"savingOptions\":\"None\",\"savingsDetail\":[{}]},{\"savingOptions\":\"RI1Year\",\"savingsDetail\":[{},{},{},{}]},{\"savingOptions\":\"RI3Year\",\"savingsDetail\":[{},{},{}]}],\"assessmentName\":\"tko\",\"discoveredLightSummary\":{\"numberOfWebApps\":926679159,\"numberOfWebAppsPerType\":[{\"webAppType\":\"Unknown\",\"count\":333094369},{\"webAppType\":\"Unknown\",\"count\":73605186},{\"webAppType\":\"Java\",\"count\":124550903}],\"numberOfWebServersPerType\":[{\"webServerType\":\"Unknown\",\"count\":1340454664},{\"webServerType\":\"Unknown\",\"count\":45967354},{\"webServerType\":\"Unknown\",\"count\":592708150},{\"webServerType\":\"Unknown\",\"count\":969530861}],\"numberOfWebServers\":1223607421,\"numberOfServers\":626726522}},\"id\":\"ipazyxoegukgjnpi\",\"name\":\"cgygev\",\"type\":\"zntypmrb\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MigrateManager manager = MigrateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.compoundAssessmentSummaryOperations() + .listByParent("ajiwkuo", "oskg", "sauuimj", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("tko", response.iterator().next().properties().assessmentName()); + Assertions.assertEquals(926679159, + response.iterator().next().properties().discoveredLightSummary().numberOfWebApps()); + Assertions.assertEquals(WebAppType.UNKNOWN, + response.iterator() + .next() + .properties() + .discoveredLightSummary() + .numberOfWebAppsPerType() + .get(0) + .webAppType()); + Assertions.assertEquals(333094369, + response.iterator().next().properties().discoveredLightSummary().numberOfWebAppsPerType().get(0).count()); + Assertions.assertEquals(WebServerType.UNKNOWN, + response.iterator() + .next() + .properties() + .discoveredLightSummary() + .numberOfWebServersPerType() + .get(0) + .webServerType()); + Assertions.assertEquals(1340454664, + response.iterator() + .next() + .properties() + .discoveredLightSummary() + .numberOfWebServersPerType() + .get(0) + .count()); + Assertions.assertEquals(1223607421, + response.iterator().next().properties().discoveredLightSummary().numberOfWebServers()); + Assertions.assertEquals(626726522, + response.iterator().next().properties().discoveredLightSummary().numberOfServers()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CostDetailsCommonTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CostDetailsCommonTests.java new file mode 100644 index 000000000000..6cddaca6e589 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/CostDetailsCommonTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.CostDetailsCommon; + +public final class CostDetailsCommonTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CostDetailsCommon model = BinaryData.fromString( + "{\"savingOptions\":\"RI3Year\",\"costDetail\":[{\"name\":\"MonthlyAvsNodeCost\",\"value\":50.263913319461274},{\"name\":\"MonthlyAvsNodeCost\",\"value\":96.52387629031274},{\"name\":\"MonthlyComputeCost\",\"value\":94.46384665424866},{\"name\":\"MonthlyAvsNetworkCost\",\"value\":34.670517161184435}]}") + .toObject(CostDetailsCommon.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DiscoveredLightSummaryTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DiscoveredLightSummaryTests.java new file mode 100644 index 000000000000..a6f888d6cd7c --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DiscoveredLightSummaryTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.DiscoveredLightSummary; +import com.azure.resourcemanager.migrate.models.WebAppType; +import com.azure.resourcemanager.migrate.models.WebServerType; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveredLightSummaryTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveredLightSummary model = BinaryData.fromString( + "{\"numberOfWebApps\":1411176046,\"numberOfWebAppsPerType\":[{\"webAppType\":\"ASP.Net\",\"count\":1459693032},{\"webAppType\":\"Unknown\",\"count\":629629065},{\"webAppType\":\"Unknown\",\"count\":1124714443}],\"numberOfWebServersPerType\":[{\"webServerType\":\"IIS\",\"count\":1424270489},{\"webServerType\":\"Tomcat\",\"count\":1033403260},{\"webServerType\":\"IIS\",\"count\":1016211190},{\"webServerType\":\"Unknown\",\"count\":374786604}],\"numberOfWebServers\":1779331295,\"numberOfServers\":1906799262}") + .toObject(DiscoveredLightSummary.class); + Assertions.assertEquals(1411176046, model.numberOfWebApps()); + Assertions.assertEquals(WebAppType.ASPNET, model.numberOfWebAppsPerType().get(0).webAppType()); + Assertions.assertEquals(1459693032, model.numberOfWebAppsPerType().get(0).count()); + Assertions.assertEquals(WebServerType.IIS, model.numberOfWebServersPerType().get(0).webServerType()); + Assertions.assertEquals(1424270489, model.numberOfWebServersPerType().get(0).count()); + Assertions.assertEquals(1779331295, model.numberOfWebServers()); + Assertions.assertEquals(1906799262, model.numberOfServers()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DownloadUrlInnerTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DownloadUrlInnerTests.java new file mode 100644 index 000000000000..2be0d82fc33d --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DownloadUrlInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.fluent.models.DownloadUrlInner; + +public final class DownloadUrlInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DownloadUrlInner model + = BinaryData.fromString("{\"assessmentReportUrl\":\"ofpdvh\",\"expirationTime\":\"2021-01-04T15:14:41Z\"}") + .toObject(DownloadUrlInner.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DownloadUrlRequestTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DownloadUrlRequestTests.java new file mode 100644 index 000000000000..83aa48df84d4 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/DownloadUrlRequestTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.DownloadUrlRequest; + +public final class DownloadUrlRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DownloadUrlRequest model = BinaryData.fromString("{}").toObject(DownloadUrlRequest.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DownloadUrlRequest model = new DownloadUrlRequest(); + model = BinaryData.fromObject(model).toObject(DownloadUrlRequest.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/ManagementDetailsTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/ManagementDetailsTests.java new file mode 100644 index 000000000000..f33d9bc0f1bb --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/ManagementDetailsTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.ManagementDetails; + +public final class ManagementDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagementDetails model = BinaryData.fromString( + "{\"name\":\"AzMon\",\"readinessSummary\":[{\"name\":\"ConditionallySuitable\",\"value\":732529011},{\"name\":\"ConditionallySuitable\",\"value\":855748692}]}") + .toObject(ManagementDetails.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/MigrationDetailsTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/MigrationDetailsTests.java new file mode 100644 index 000000000000..4ab0d8724c77 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/MigrationDetailsTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.MigrationDetails; + +public final class MigrationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MigrationDetails model = BinaryData.fromString( + "{\"readinessSummary\":[{\"name\":\"ConditionallySuitable\",\"value\":870158563},{\"name\":\"Unknown\",\"value\":1121754168},{\"name\":\"ConditionallySuitable\",\"value\":1092181664},{\"name\":\"Suitable\",\"value\":219333087}],\"migrationType\":\"Replatform\"}") + .toObject(MigrationDetails.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairCloudSuitabilityCommonTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairCloudSuitabilityCommonTests.java new file mode 100644 index 000000000000..73ccf2183d84 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairCloudSuitabilityCommonTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.NameValuePairCloudSuitabilityCommon; + +public final class NameValuePairCloudSuitabilityCommonTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NameValuePairCloudSuitabilityCommon model + = BinaryData.fromString("{\"name\":\"ReadinessUnknown\",\"value\":1917660193}") + .toObject(NameValuePairCloudSuitabilityCommon.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairCostTypeTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairCostTypeTests.java new file mode 100644 index 000000000000..9ead13969ff3 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairCostTypeTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.NameValuePairCostType; + +public final class NameValuePairCostTypeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NameValuePairCostType model + = BinaryData.fromString("{\"name\":\"MonthlyAzureHybridCost\",\"value\":53.58388872924316}") + .toObject(NameValuePairCostType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairSavingsTypeTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairSavingsTypeTests.java new file mode 100644 index 000000000000..714474545457 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/NameValuePairSavingsTypeTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.NameValuePairSavingsType; + +public final class NameValuePairSavingsTypeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NameValuePairSavingsType model + = BinaryData.fromString("{\"name\":\"MonthlyAzureHybridCostSavings\",\"value\":88.81486754768208}") + .toObject(NameValuePairSavingsType.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationDisplayTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..3b74a4b18697 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationInnerTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationInnerTests.java new file mode 100644 index 000000000000..8cca4a21d687 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationListResultTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationListResultTests.java new file mode 100644 index 000000000000..b7df8b3b7cb4 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.implementation.models.OperationListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationsListMockTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..d904721fcae2 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/OperationsListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.migrate.MigrateManager; +import com.azure.resourcemanager.migrate.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"zvddntwndeicbtwn\",\"isDataAction\":false,\"display\":{\"provider\":\"vuhrhcffcyddgl\",\"resource\":\"t\",\"operation\":\"qkwpyeicxmqc\",\"description\":\"q\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MigrateManager manager = MigrateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/SavingsDetailsCommonTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/SavingsDetailsCommonTests.java new file mode 100644 index 000000000000..e810f3308d90 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/SavingsDetailsCommonTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.SavingsDetailsCommon; + +public final class SavingsDetailsCommonTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SavingsDetailsCommon model = BinaryData.fromString( + "{\"savingOptions\":\"RI3Year\",\"savingsDetail\":[{\"name\":\"MonthlyVcfByolCostDifference\",\"value\":91.77639017700017}]}") + .toObject(SavingsDetailsCommon.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/SourceDetailsTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/SourceDetailsTests.java new file mode 100644 index 000000000000..551263c551bf --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/SourceDetailsTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.SourceDetails; + +public final class SourceDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SourceDetails model = BinaryData.fromString( + "{\"sourceName\":\"MySQLServer\",\"sourceType\":\"Server\",\"platform\":\"Unknown\",\"count\":315783866}") + .toObject(SourceDetails.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetAssessmentArmIdsTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetAssessmentArmIdsTests.java new file mode 100644 index 000000000000..d4f4884e2220 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetAssessmentArmIdsTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.TargetAssessmentArmIds; +import org.junit.jupiter.api.Assertions; + +public final class TargetAssessmentArmIdsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TargetAssessmentArmIds model = BinaryData + .fromString( + "{\"aks\":\"emkkvnipjox\",\"azureAppService\":\"nchgej\",\"azureAppServiceContainer\":\"odmailzyd\"}") + .toObject(TargetAssessmentArmIds.class); + Assertions.assertEquals("emkkvnipjox", model.aks()); + Assertions.assertEquals("nchgej", model.azureAppService()); + Assertions.assertEquals("odmailzyd", model.azureAppServiceContainer()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TargetAssessmentArmIds model = new TargetAssessmentArmIds().withAks("emkkvnipjox") + .withAzureAppService("nchgej") + .withAzureAppServiceContainer("odmailzyd"); + model = BinaryData.fromObject(model).toObject(TargetAssessmentArmIds.class); + Assertions.assertEquals("emkkvnipjox", model.aks()); + Assertions.assertEquals("nchgej", model.azureAppService()); + Assertions.assertEquals("odmailzyd", model.azureAppServiceContainer()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetDetailsTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetDetailsTests.java new file mode 100644 index 000000000000..80fdb4594392 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetDetailsTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.TargetDetails; + +public final class TargetDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TargetDetails model = BinaryData + .fromString("{\"targetName\":\"Avs\",\"targetType\":\"Server\",\"platform\":\"PaaS\",\"count\":1917182529}") + .toObject(TargetDetails.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetSourcePairTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetSourcePairTests.java new file mode 100644 index 000000000000..4644858c28b4 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/TargetSourcePairTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.TargetSourcePair; + +public final class TargetSourcePairTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TargetSourcePair model = BinaryData.fromString( + "{\"sourceRef\":\"IIS\",\"targetRef\":\"AzureSpringApps\",\"sourceCount\":326786210,\"targetCount\":584563122,\"migrationDetails\":{\"readinessSummary\":[{\"name\":\"ReadinessUnknown\",\"value\":1015054859}],\"migrationType\":\"Rearchitect\"},\"managementDetails\":[{\"name\":\"AzureBackup\",\"readinessSummary\":[{\"name\":\"ReadinessUnknown\",\"value\":1785230840}]}],\"costDetails\":[{\"savingOptions\":\"None\",\"costDetail\":[{\"name\":\"MonthlyAvsNodeCost\",\"value\":16.047049583758998}]},{\"savingOptions\":\"RI1Year\",\"costDetail\":[{\"name\":\"MonthlyUltraStorageCost\",\"value\":26.788138158909092},{\"name\":\"MonthlyStandardSsdStorageCost\",\"value\":93.00579310542419},{\"name\":\"MonthlyManagementCost\",\"value\":99.89794584243784}]}],\"savingsDetails\":[{\"savingOptions\":\"RI3Year\",\"savingsDetail\":[{\"name\":\"MonthlyVcfByolCostDifference\",\"value\":51.7374080641474},{\"name\":\"MonthlyAzureHybridCostSavings\",\"value\":36.84506837631895},{\"name\":\"MonthlyLinuxAzureHybridCostSavings\",\"value\":24.205190277415088}]},{\"savingOptions\":\"SavingsPlan3Year\",\"savingsDetail\":[{\"name\":\"MonthlyAzureHybridCostSavings\",\"value\":98.09041073934307}]},{\"savingOptions\":\"RI3Year\",\"savingsDetail\":[{\"name\":\"MonthlyLinuxAzureHybridCostSavings\",\"value\":87.17454431102176},{\"name\":\"MonthlyAhubSqlCostSavings\",\"value\":78.21393250115334},{\"name\":\"MonthlyAzureHybridCostSavings\",\"value\":2.824151621898463}]}],\"confidenceScore\":92.56135268758864}") + .toObject(TargetSourcePair.class); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryInnerTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryInnerTests.java new file mode 100644 index 000000000000..f7b00f87569d --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryInnerTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.fluent.models.WebAppCompoundAssessmentSummaryInner; +import com.azure.resourcemanager.migrate.models.WebAppType; +import com.azure.resourcemanager.migrate.models.WebServerType; +import org.junit.jupiter.api.Assertions; + +public final class WebAppCompoundAssessmentSummaryInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebAppCompoundAssessmentSummaryInner model = BinaryData.fromString( + "{\"properties\":{\"summaryType\":\"Unknown\",\"summaryName\":\"ininmay\",\"sources\":[{\"sourceName\":\"Machine\",\"sourceType\":\"Unknown\",\"platform\":\"PaaS\",\"count\":359056784}],\"targets\":[{\"targetName\":\"MySQLAzureFlexServer\",\"targetType\":\"Host\",\"platform\":\"IaaS\",\"count\":1777503285},{\"targetName\":\"AKS\",\"targetType\":\"Instance\",\"platform\":\"IaaS\",\"count\":1781320199},{\"targetName\":\"AzureAppService\",\"targetType\":\"ManagementServer\",\"platform\":\"Unknown\",\"count\":1544576839},{\"targetName\":\"SAPAzureInstance\",\"targetType\":\"Database\",\"platform\":\"Unknown\",\"count\":401724837}],\"targetSourceMapping\":[{\"sourceRef\":\"MySQLServer\",\"targetRef\":\"AzureAppService\",\"sourceCount\":1574404612,\"targetCount\":1255006284,\"migrationDetails\":{\"readinessSummary\":[{}],\"migrationType\":\"Unknown\"},\"managementDetails\":[{\"name\":\"AzMon\",\"readinessSummary\":[{}]},{\"name\":\"SCOMMI\",\"readinessSummary\":[{},{},{}]},{\"name\":\"AUM\",\"readinessSummary\":[{},{}]}],\"costDetails\":[{\"savingOptions\":\"SavingsPlan1Year\",\"costDetail\":[{},{},{},{}]},{\"savingOptions\":\"SavingsPlan1Year\",\"costDetail\":[{},{},{},{}]}],\"savingsDetails\":[{\"savingOptions\":\"RI3Year\",\"savingsDetail\":[{},{},{},{}]},{\"savingOptions\":\"SavingsPlan3Year\",\"savingsDetail\":[{},{},{}]},{\"savingOptions\":\"None\",\"savingsDetail\":[{}]}],\"confidenceScore\":2.1371346246927714}],\"costComponents\":[{\"savingOptions\":\"SavingsPlan1Year\",\"costDetail\":[{\"name\":\"MonthlyAvsNodeCost\",\"value\":54.34447993696888},{\"name\":\"MonthlyAvsNetworkCost\",\"value\":63.69759071565577},{\"name\":\"DataProtectionService\",\"value\":69.17137609276845},{\"name\":\"MonthlyLicensingCost\",\"value\":22.524183977620417}]},{\"savingOptions\":\"RI3Year\",\"costDetail\":[{\"name\":\"MonthlyBandwidthCost\",\"value\":70.73601260889994},{\"name\":\"MonthlySecurityCost\",\"value\":76.37581436714929}]},{\"savingOptions\":\"SavingsPlan3Year\",\"costDetail\":[{\"name\":\"MonthlyStandardSsdStorageCost\",\"value\":31.27041471970862},{\"name\":\"MonthlyUltraStorageCost\",\"value\":90.24083584928869},{\"name\":\"MonthlyPremiumV2StorageCost\",\"value\":66.38584562037443}]}],\"savingsComponents\":[{\"savingOptions\":\"SavingsPlan1Year\",\"savingsDetail\":[{\"name\":\"MonthlyVcfByolCostDifference\",\"value\":5.340740989661663},{\"name\":\"MonthlyAzureHybridCostSavings\",\"value\":58.09922143752687},{\"name\":\"MonthlyLinuxAzureHybridCostSavings\",\"value\":74.74876222106718},{\"name\":\"MonthlyVcfByolCostDifference\",\"value\":43.36704068838252}]}],\"assessmentName\":\"xsabkyqdu\",\"discoveredLightSummary\":{\"numberOfWebApps\":2066308678,\"numberOfWebAppsPerType\":[{\"webAppType\":\"ASP.Net\",\"count\":1447556622}],\"numberOfWebServersPerType\":[{\"webServerType\":\"Unknown\",\"count\":1089417783},{\"webServerType\":\"Unknown\",\"count\":1471497811},{\"webServerType\":\"Unknown\",\"count\":700767866}],\"numberOfWebServers\":1700892403,\"numberOfServers\":2049933545}},\"id\":\"pdappds\",\"name\":\"dkvwrwjfe\",\"type\":\"snhu\"}") + .toObject(WebAppCompoundAssessmentSummaryInner.class); + Assertions.assertEquals("xsabkyqdu", model.properties().assessmentName()); + Assertions.assertEquals(2066308678, model.properties().discoveredLightSummary().numberOfWebApps()); + Assertions.assertEquals(WebAppType.ASPNET, + model.properties().discoveredLightSummary().numberOfWebAppsPerType().get(0).webAppType()); + Assertions.assertEquals(1447556622, + model.properties().discoveredLightSummary().numberOfWebAppsPerType().get(0).count()); + Assertions.assertEquals(WebServerType.UNKNOWN, + model.properties().discoveredLightSummary().numberOfWebServersPerType().get(0).webServerType()); + Assertions.assertEquals(1089417783, + model.properties().discoveredLightSummary().numberOfWebServersPerType().get(0).count()); + Assertions.assertEquals(1700892403, model.properties().discoveredLightSummary().numberOfWebServers()); + Assertions.assertEquals(2049933545, model.properties().discoveredLightSummary().numberOfServers()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryListResultTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryListResultTests.java new file mode 100644 index 000000000000..84acf7eebc05 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryListResultTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.implementation.models.WebAppCompoundAssessmentSummaryListResult; +import com.azure.resourcemanager.migrate.models.WebAppType; +import com.azure.resourcemanager.migrate.models.WebServerType; +import org.junit.jupiter.api.Assertions; + +public final class WebAppCompoundAssessmentSummaryListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebAppCompoundAssessmentSummaryListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"summaryType\":\"Target\",\"summaryName\":\"cyshurzafbljjgp\",\"sources\":[{\"sourceName\":\"SqlDatabase\",\"sourceType\":\"Host\",\"platform\":\"PaaS\",\"count\":232928194}],\"targets\":[{\"targetName\":\"SAPAzureInstance\",\"targetType\":\"WebApplication\",\"platform\":\"PaaS\",\"count\":1134924822},{\"targetName\":\"Unknown\",\"targetType\":\"ManagementServer\",\"platform\":\"Unknown\",\"count\":1232172587}],\"targetSourceMapping\":[{\"sourceRef\":\"TomCat\",\"targetRef\":\"AzureSpringApps\",\"sourceCount\":375716095,\"targetCount\":194307867,\"migrationDetails\":{},\"managementDetails\":[{},{}],\"costDetails\":[{}],\"savingsDetails\":[{},{},{}],\"confidenceScore\":23.882560269206145},{\"sourceRef\":\"Unknown\",\"targetRef\":\"Unknown\",\"sourceCount\":1841580602,\"targetCount\":812550328,\"migrationDetails\":{},\"managementDetails\":[{},{}],\"costDetails\":[{},{}],\"savingsDetails\":[{}],\"confidenceScore\":62.25381731358313},{\"sourceRef\":\"SAPInstance\",\"targetRef\":\"Avs\",\"sourceCount\":1273206758,\"targetCount\":865429737,\"migrationDetails\":{},\"managementDetails\":[{},{},{},{}],\"costDetails\":[{},{},{}],\"savingsDetails\":[{},{}],\"confidenceScore\":12.013875822180943},{\"sourceRef\":\"TomCat\",\"targetRef\":\"SqlMI\",\"sourceCount\":132549399,\"targetCount\":1116116329,\"migrationDetails\":{},\"managementDetails\":[{},{},{}],\"costDetails\":[{}],\"savingsDetails\":[{},{}],\"confidenceScore\":22.61402041078452}],\"costComponents\":[{\"savingOptions\":\"SavingsPlan3Year\",\"costDetail\":[{},{},{},{}]}],\"savingsComponents\":[{\"savingOptions\":\"CustomAzureOfferCode\",\"savingsDetail\":[{},{},{}]},{\"savingOptions\":\"RI1Year\",\"savingsDetail\":[{},{},{},{}]},{\"savingOptions\":\"SavingsPlan1Year\",\"savingsDetail\":[{},{}]},{\"savingOptions\":\"RI3Year\",\"savingsDetail\":[{},{},{},{}]}],\"assessmentName\":\"ijcoejctb\",\"discoveredLightSummary\":{\"numberOfWebApps\":1083194269,\"numberOfWebAppsPerType\":[{\"webAppType\":\"ASP.Net\",\"count\":169768909},{\"webAppType\":\"ASP.Net\",\"count\":934868772},{\"webAppType\":\"ASP.Net\",\"count\":475549149}],\"numberOfWebServersPerType\":[{\"webServerType\":\"IIS\",\"count\":1357856800}],\"numberOfWebServers\":1619207085,\"numberOfServers\":395689109}},\"id\":\"exxppofmxaxcfjp\",\"name\":\"ddtocjjxhvp\",\"type\":\"o\"}],\"nextLink\":\"xhdzxibqeojnx\"}") + .toObject(WebAppCompoundAssessmentSummaryListResult.class); + Assertions.assertEquals("ijcoejctb", model.value().get(0).properties().assessmentName()); + Assertions.assertEquals(1083194269, + model.value().get(0).properties().discoveredLightSummary().numberOfWebApps()); + Assertions.assertEquals(WebAppType.ASPNET, + model.value().get(0).properties().discoveredLightSummary().numberOfWebAppsPerType().get(0).webAppType()); + Assertions.assertEquals(169768909, + model.value().get(0).properties().discoveredLightSummary().numberOfWebAppsPerType().get(0).count()); + Assertions.assertEquals(WebServerType.IIS, + model.value() + .get(0) + .properties() + .discoveredLightSummary() + .numberOfWebServersPerType() + .get(0) + .webServerType()); + Assertions.assertEquals(1357856800, + model.value().get(0).properties().discoveredLightSummary().numberOfWebServersPerType().get(0).count()); + Assertions.assertEquals(1619207085, + model.value().get(0).properties().discoveredLightSummary().numberOfWebServers()); + Assertions.assertEquals(395689109, + model.value().get(0).properties().discoveredLightSummary().numberOfServers()); + Assertions.assertEquals("xhdzxibqeojnx", model.nextLink()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryPropertiesTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryPropertiesTests.java new file mode 100644 index 000000000000..be22b698f033 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppCompoundAssessmentSummaryPropertiesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.WebAppCompoundAssessmentSummaryProperties; +import com.azure.resourcemanager.migrate.models.WebAppType; +import com.azure.resourcemanager.migrate.models.WebServerType; +import org.junit.jupiter.api.Assertions; + +public final class WebAppCompoundAssessmentSummaryPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebAppCompoundAssessmentSummaryProperties model = BinaryData.fromString( + "{\"summaryType\":\"Target\",\"summaryName\":\"tmrldhugjzzdatq\",\"sources\":[{\"sourceName\":\"Unknown\",\"sourceType\":\"Server\",\"platform\":\"IaaS\",\"count\":885062254}],\"targets\":[{\"targetName\":\"Unknown\",\"targetType\":\"Instance\",\"platform\":\"PaaS\",\"count\":680331954},{\"targetName\":\"Unknown\",\"targetType\":\"Database\",\"platform\":\"Unknown\",\"count\":629729450},{\"targetName\":\"AzureAppServiceContainer\",\"targetType\":\"ManagementServer\",\"platform\":\"PaaS\",\"count\":222855388}],\"targetSourceMapping\":[{\"sourceRef\":\"MySQLServer\",\"targetRef\":\"Unknown\",\"sourceCount\":1868047247,\"targetCount\":1438714337,\"migrationDetails\":{\"readinessSummary\":[{\"name\":\"ReadinessUnknown\",\"value\":1720882214},{\"name\":\"Unknown\",\"value\":15479828},{\"name\":\"SuitableWithWarnings\",\"value\":1518589486},{\"name\":\"Unknown\",\"value\":779158690}],\"migrationType\":\"Retain\"},\"managementDetails\":[{\"name\":\"AUM\",\"readinessSummary\":[{},{},{},{}]}],\"costDetails\":[{\"savingOptions\":\"CustomAzureOfferCode\",\"costDetail\":[{},{},{}]},{\"savingOptions\":\"None\",\"costDetail\":[{}]},{\"savingOptions\":\"SavingsPlan1Year\",\"costDetail\":[{}]}],\"savingsDetails\":[{\"savingOptions\":\"RI1Year\",\"savingsDetail\":[{},{}]}],\"confidenceScore\":68.94035595577468},{\"sourceRef\":\"TomCat\",\"targetRef\":\"AzureAppService\",\"sourceCount\":250588386,\"targetCount\":485783320,\"migrationDetails\":{\"readinessSummary\":[{\"name\":\"Suitable\",\"value\":1579471908}],\"migrationType\":\"Unknown\"},\"managementDetails\":[{\"name\":\"AzMon\",\"readinessSummary\":[{},{},{},{}]}],\"costDetails\":[{\"savingOptions\":\"CustomAzureOfferCode\",\"costDetail\":[{},{},{},{}]}],\"savingsDetails\":[{\"savingOptions\":\"RI3Year\",\"savingsDetail\":[{},{}]},{\"savingOptions\":\"None\",\"savingsDetail\":[{},{}]},{\"savingOptions\":\"SavingsPlan3Year\",\"savingsDetail\":[{}]},{\"savingOptions\":\"None\",\"savingsDetail\":[{},{},{}]}],\"confidenceScore\":73.38424388424455},{\"sourceRef\":\"SqlInstance\",\"targetRef\":\"AzureAppServiceContainer\",\"sourceCount\":269319267,\"targetCount\":1891413641,\"migrationDetails\":{\"readinessSummary\":[{\"name\":\"ConditionallySuitable\",\"value\":1951665736},{\"name\":\"NotSuitable\",\"value\":2110455897},{\"name\":\"SuitableWithWarnings\",\"value\":1519721589}],\"migrationType\":\"Replatform\"},\"managementDetails\":[{\"name\":\"SCOMMI\",\"readinessSummary\":[{},{}]},{\"name\":\"AzureBackup\",\"readinessSummary\":[{},{},{},{}]},{\"name\":\"AzMon\",\"readinessSummary\":[{},{},{},{}]},{\"name\":\"AUM\",\"readinessSummary\":[{}]}],\"costDetails\":[{\"savingOptions\":\"RI1Year\",\"costDetail\":[{},{},{},{}]},{\"savingOptions\":\"SavingsPlan1Year\",\"costDetail\":[{}]},{\"savingOptions\":\"RI1Year\",\"costDetail\":[{},{},{}]}],\"savingsDetails\":[{\"savingOptions\":\"CustomAzureOfferCode\",\"savingsDetail\":[{},{},{}]}],\"confidenceScore\":85.7439436271531}],\"costComponents\":[{\"savingOptions\":\"RI3Year\",\"costDetail\":[{\"name\":\"MonthlyStorageCost\",\"value\":54.45829781297089}]}],\"savingsComponents\":[{\"savingOptions\":\"SavingsPlan3Year\",\"savingsDetail\":[{\"name\":\"MonthlyLinuxAzureHybridCostSavings\",\"value\":13.896995755702813}]},{\"savingOptions\":\"CustomAzureOfferCode\",\"savingsDetail\":[{\"name\":\"MonthlyAzureHybridCostSavings\",\"value\":97.49830378258812},{\"name\":\"MonthlyAhubSqlCostSavings\",\"value\":95.44545388571125},{\"name\":\"MonthlyLinuxAzureHybridCostSavings\",\"value\":79.69427470836081}]}],\"assessmentName\":\"ysvlejuvf\",\"discoveredLightSummary\":{\"numberOfWebApps\":984806813,\"numberOfWebAppsPerType\":[{\"webAppType\":\"ASP.Net\",\"count\":1242969129},{\"webAppType\":\"Unknown\",\"count\":1106115756},{\"webAppType\":\"Java\",\"count\":658406237},{\"webAppType\":\"Java\",\"count\":1426709654}],\"numberOfWebServersPerType\":[{\"webServerType\":\"Unknown\",\"count\":181237829},{\"webServerType\":\"Tomcat\",\"count\":1500151010},{\"webServerType\":\"Tomcat\",\"count\":590807378},{\"webServerType\":\"IIS\",\"count\":1609681254}],\"numberOfWebServers\":928932995,\"numberOfServers\":95959907}}") + .toObject(WebAppCompoundAssessmentSummaryProperties.class); + Assertions.assertEquals("ysvlejuvf", model.assessmentName()); + Assertions.assertEquals(984806813, model.discoveredLightSummary().numberOfWebApps()); + Assertions.assertEquals(WebAppType.ASPNET, + model.discoveredLightSummary().numberOfWebAppsPerType().get(0).webAppType()); + Assertions.assertEquals(1242969129, model.discoveredLightSummary().numberOfWebAppsPerType().get(0).count()); + Assertions.assertEquals(WebServerType.UNKNOWN, + model.discoveredLightSummary().numberOfWebServersPerType().get(0).webServerType()); + Assertions.assertEquals(181237829, model.discoveredLightSummary().numberOfWebServersPerType().get(0).count()); + Assertions.assertEquals(928932995, model.discoveredLightSummary().numberOfWebServers()); + Assertions.assertEquals(95959907, model.discoveredLightSummary().numberOfServers()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppsPerTypeTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppsPerTypeTests.java new file mode 100644 index 000000000000..f639482cd14f --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebAppsPerTypeTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.WebAppType; +import com.azure.resourcemanager.migrate.models.WebAppsPerType; +import org.junit.jupiter.api.Assertions; + +public final class WebAppsPerTypeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebAppsPerType model + = BinaryData.fromString("{\"webAppType\":\"Java\",\"count\":1701008083}").toObject(WebAppsPerType.class); + Assertions.assertEquals(WebAppType.JAVA, model.webAppType()); + Assertions.assertEquals(1701008083, model.count()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebServersPerTypeTests.java b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebServersPerTypeTests.java new file mode 100644 index 000000000000..286ee77af9fd --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/src/test/java/com/azure/resourcemanager/migrate/generated/WebServersPerTypeTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.migrate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.migrate.models.WebServerType; +import com.azure.resourcemanager.migrate.models.WebServersPerType; +import org.junit.jupiter.api.Assertions; + +public final class WebServersPerTypeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebServersPerType model = BinaryData.fromString("{\"webServerType\":\"Tomcat\",\"count\":1007195801}") + .toObject(WebServersPerType.class); + Assertions.assertEquals(WebServerType.TOMCAT, model.webServerType()); + Assertions.assertEquals(1007195801, model.count()); + } +} diff --git a/sdk/migrate/azure-resourcemanager-migrate/tsp-location.yaml b/sdk/migrate/azure-resourcemanager-migrate/tsp-location.yaml new file mode 100644 index 000000000000..466dacdb1fe7 --- /dev/null +++ b/sdk/migrate/azure-resourcemanager-migrate/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/migrate/AssessmentProjects.Management/WebAppCompoundAssessments.Management +commit: 1460ec8f594872ffd9e084295809a39118d0c3f4 +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/migrate/AssessmentProjects.Management/Common diff --git a/sdk/migrate/ci.yml b/sdk/migrate/ci.yml new file mode 100644 index 000000000000..f486884722e2 --- /dev/null +++ b/sdk/migrate/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/migrate/ci.yml + - sdk/migrate/azure-resourcemanager-migrate/ + exclude: + - sdk/migrate/pom.xml + - sdk/migrate/azure-resourcemanager-migrate/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/migrate/ci.yml + - sdk/migrate/azure-resourcemanager-migrate/ + exclude: + - sdk/migrate/pom.xml + - sdk/migrate/azure-resourcemanager-migrate/pom.xml + +parameters: + - name: release_azureresourcemanagermigrate + displayName: azure-resourcemanager-migrate + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: migrate + Artifacts: + - name: azure-resourcemanager-migrate + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermigrate + releaseInBatch: ${{ parameters.release_azureresourcemanagermigrate }} diff --git a/sdk/migrate/pom.xml b/sdk/migrate/pom.xml new file mode 100644 index 000000000000..2fb619f945f4 --- /dev/null +++ b/sdk/migrate/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-migrate-service + pom + 1.0.0 + + + azure-resourcemanager-migrate + +